<div class="gmail_quote">2009/2/9 Aaron Bentley <span dir="ltr"><<a href="mailto:aaron@aaronbentley.com">aaron@aaronbentley.com</a>></span><br><div class="Ih2E3d">
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">Marius Kruger wrote:<br>
> Actually, considering the change is just<br>
> Repository.set_make_working_trees, it might be simpler to just invoke it<br>
> directly.<br>
><br>
><br>
> done.<br>
<br>
</div>No, I meant not using Reconfigure at all. If you're using Reconfigure,<br>
then the change should be caused by apply.</blockquote><div><br>ok. Because Reconfigure gives other advantages like checking if we<br>have a repository present, I chose to keep on using it.<br>So I moved the actual change to apply() again.<br>
<br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">> > I did add a test that --with-no-trees doesn't screw with an existing<br>
> > working tree (the rewrite should make that impossible anyway). I'm<br>
> > not real happy with the test; it sorta takes a long stroll around the<br>
> > garden to check if a door it just opened is open. There has to be a<br>
> > less absurd way of writing it, but that's far past my competence.<br>
><br>
> Well, you can skip some of the blackbox tests. The blackbox tests<br>
> should prove that it works at all, not duplicate the unit tests.<br>
><br>
><br>
> I left them in, as they were already done, and they do add some value:<br>
> they test that we support the flags and that the user gets good error<br>
> messages.<br><br>It's okay to leave them it, but the error messages should be tested in<br>
the unit tests as well.<br></blockquote><br>done.<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">
> > @@ -302,3 +325,7 @@<br>
> > local_branch.bind(branch.Branch.open(bind_location))<br>
> > if self._destroy_repository:<br>
> > self.bzrdir.destroy_repository()<br>
> > + if self._set_with_trees:<br>
> > + self.repository.set_make_working_trees(True)<br>
> > + if self._set_with_no_trees:<br>
> > + self.repository.set_make_working_trees(False)<br>
><br>
> self.repository refers to the current repository, but won't refer to a<br>
> newly-created repository. You'll want to use the local variable 'repo'<br>
> instead.<br>
><br>
><br>
> AFAICT, newly-created repositories are always shared=False, which is<br>
> something the new actions claim not to support.<br>
> So since changes are now done in set_repository_trees() directly,<br>
> we will ignore newly-created repositories, which is fine IMO,<br>
> as I can't see us getting into such a situation from the commandline.<br>
<br>
</div>This is an API, not the commandline. We may have other clients that use<br>
it differently. We may extend the commandline later.<br>
<br>
It does not make sense to write fragile code when it's just as easy to<br>
write robust code.</blockquote><div><br>fair enough. sorry. done: using 'repo' now.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> # Bazaar merge directive format 2 (Bazaar 0.90)<br>
> # revision_id: amanic@gmail.com-20090206014740-6gbah25yvrkocm6t<br>
> # target_branch: ../bzr.dev/<br>
<br>
^^^ Please set the public_branch for your local mirror</blockquote><div><br>eish <\me scratches head>. `bzr send` seems to be a black art <br>with this public_branch location that I just don't seem to get right :( <br>
It seems to work great, but not being able to set it directly <br>with `reconfigure` or something makes it a bit obscure.<br>But that is another story.<br>fixed now. thanks.<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> === modified file 'bzrlib/builtins.py'<br>
> --- bzrlib/builtins.py 2009-02-02 05:43:13 +0000<br>
> +++ bzrlib/builtins.py 2009-02-05 23:31:14 +0000<br>
> @@ -4851,7 +4851,11 @@<br>
> ' checkout (with no local history).',<br>
> standalone='Reconfigure to be a standalone branch '<br>
> '(i.e. stop using shared repository).',<br>
> - use_shared='Reconfigure to use a shared repository.'),<br>
> + use_shared='Reconfigure to use a shared repository.',<br>
> + with_trees='Reconfigure repository to create '<br>
> + 'working trees on branches by default',<br>
> + with_no_trees='Reconfigure repository to not create '<br>
> + 'working trees on branches by default'),<br>
> Option('bind-to', help='Branch to bind checkout to.',<br>
> type=str),<br>
> Option('force',<br>
> @@ -4877,6 +4881,12 @@<br>
> reconfiguration = reconfigure.Reconfigure.to_use_shared(directory)<br>
> elif target_type == 'standalone':<br>
> reconfiguration = reconfigure.Reconfigure.to_standalone(directory)<br>
> + elif target_type == 'with-trees':<br>
> + reconfiguration = reconfigure.Reconfigure.set_repository_trees(<br>
> + directory, True)<br>
> + elif target_type == 'with-no-trees':<br>
> + reconfiguration = reconfigure.Reconfigure.set_repository_trees(<br>
> + directory, False)<br>
> reconfiguration.apply(force)<br>
<br>
^^^ It doesn't make sense to do reconfiguration.apply for with-trees or<br>
with-no-trees.</blockquote><div><br>we now do the actual change in apply() again.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> === modified file 'bzrlib/errors.py'<br>
> --- bzrlib/errors.py 2009-01-27 05:04:43 +0000<br>
> +++ bzrlib/errors.py 2009-02-05 23:31:14 +0000<br>
> @@ -2744,6 +2744,18 @@<br>
> _fmt = "'%(display_url)s' is already standalone."<br>
><br>
><br>
> +class AlreadyWithTrees(BzrDirError):<br>
> +<br>
> + _fmt = "Shared repository '%(display_url)s' already creates " \<br>
> + "working trees."<br>
<br>
We generally use parentheses to split lines, e.g.:<br>
<br>
_fmt = ("Shared repository '%(display_url)s' already creates"<br>
" working trees.")</blockquote><div><br>done.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> === modified file 'bzrlib/tests/test_reconfigure.py'<br>
> --- bzrlib/tests/test_reconfigure.py 2008-04-25 22:16:00 +0000<br>
> +++ bzrlib/tests/test_reconfigure.py 2009-01-08 08:13:29 +0000<br>
> @@ -377,3 +377,33 @@<br>
> def test_unsynced_branch_to_lightweight_checkout_forced(self):<br>
> reconfiguration = self.make_unsynced_branch_reconfiguration()<br>
> reconfiguration.apply(force=True)<br>
> +<br>
> + def make_repository_with_without_trees(self, with_trees):<br>
<div class="Ih2E3d">> + repo = self.make_repository('repo', shared=True)<br>
</div>> + repo.set_make_working_trees(with_trees)<br>
> + return repo<br>
> +<br>
> + def test_make_with_trees(self):<br>
> + repo = self.make_repository_with_without_trees(False)<br>
> + reconfiguration = reconfigure.Reconfigure.set_repository_trees(<br>
> + repo.bzrdir, True)<br>
> + reconfiguration.apply()<br>
> + self.assertIs(True, repo.make_working_trees())<br>
> +<br>
> + def test_make_without_trees(self):<br>
> + repo = self.make_repository_with_without_trees(True)<br>
> + reconfiguration = reconfigure.Reconfigure.set_repository_trees(<br>
> + repo.bzrdir, False)<br>
> + reconfiguration.apply()<br>
> + self.assertIs(False, repo.make_working_trees())<br>
> +<br>
> + def test_make_with_trees_already_with_trees(self):<br>
> + repo = self.make_repository_with_without_trees(True)<br>
> + self.assertRaises(errors.AlreadyWithTrees,<br>
> + reconfigure.Reconfigure.set_repository_trees, repo.bzrdir, True)<br>
<br>
You should also test the text of the error, like so:<br>
<br>
e = self.assertRaises(errors.AlreadyWithTrees,<br>
reconfigure.Reconfigure.set_repository_trees, repo.bzrdir, True)<br>
self.assertEqual('Already has trees!', str(e))</blockquote><div><br>done for both tests (with and without).<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> +<br>
> + def test_make_without_trees_already_no_trees(self):<br>
> + repo = self.make_repository_with_without_trees(False)<br>
> + self.assertRaises(errors.AlreadyWithNoTrees,<br>
> + reconfigure.Reconfigure.set_repository_trees, repo.bzrdir, False)<br>
> +<br>
<br>
You also need to test the case where errors.ReconfigurationNotSupported<br>
is raised.</blockquote><div> </div></div>done.<br><br clear="all">thanks a lot for the review and spoon feeding me the fixes:)<br>-- <br><| regards<br>U| Marius<br>H| <>< <br>