<div class="gmail_quote">2009/2/9 Aaron Bentley <span dir="ltr">&lt;<a href="mailto:aaron@aaronbentley.com">aaron@aaronbentley.com</a>&gt;</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>
&gt; &nbsp; &nbsp; Actually, considering the change is just<br>
&gt; &nbsp; &nbsp; Repository.set_make_working_trees, it might be simpler to just invoke it<br>
&gt; &nbsp; &nbsp; directly.<br>
&gt;<br>
&gt;<br>
&gt; done.<br>
<br>
</div>No, I meant not using Reconfigure at all. &nbsp;If you&#39;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>
&nbsp;<br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">&gt; &nbsp; &nbsp; &gt; I did add a test that --with-no-trees doesn&#39;t screw with an existing<br>

&gt; &nbsp; &nbsp; &gt; working tree (the rewrite should make that impossible anyway). &nbsp;I&#39;m<br>
&gt; &nbsp; &nbsp; &gt; not real happy with the test; it sorta takes a long stroll around the<br>
&gt; &nbsp; &nbsp; &gt; garden to check if a door it just opened is open. &nbsp;There has to be a<br>
&gt; &nbsp; &nbsp; &gt; less absurd way of writing it, but that&#39;s far past my competence.<br>
&gt;<br>
&gt; &nbsp; &nbsp; Well, you can skip some of the blackbox tests. &nbsp;The blackbox tests<br>
&gt; &nbsp; &nbsp; should prove that it works at all, not duplicate the unit tests.<br>
&gt;<br>
&gt;<br>
&gt; I left them in, as they were already done, and they do add some value:<br>
&gt; they test that we support the flags and that the user gets good error<br>
&gt; messages.<br><br>It&#39;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">
&gt; &nbsp; &nbsp; &gt; @@ -302,3 +325,7 @@<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local_branch.bind(branch.Branch.open(bind_location))<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if self._destroy_repository:<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.bzrdir.destroy_repository()<br>
&gt; &nbsp; &nbsp; &gt; + &nbsp; &nbsp; &nbsp; &nbsp;if self._set_with_trees:<br>
&gt; &nbsp; &nbsp; &gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.repository.set_make_working_trees(True)<br>
&gt; &nbsp; &nbsp; &gt; + &nbsp; &nbsp; &nbsp; &nbsp;if self._set_with_no_trees:<br>
&gt; &nbsp; &nbsp; &gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.repository.set_make_working_trees(False)<br>
&gt;<br>
&gt; &nbsp; &nbsp; self.repository refers to the current repository, but won&#39;t refer to a<br>
&gt; &nbsp; &nbsp; newly-created repository. &nbsp;You&#39;ll want to use the local variable &#39;repo&#39;<br>
&gt; &nbsp; &nbsp; instead.<br>
&gt;<br>
&gt;<br>
&gt; AFAICT, &nbsp;newly-created repositories are always shared=False, which is<br>
&gt; something the new actions claim not to support.<br>
&gt; So since changes are now done in set_repository_trees() directly,<br>
&gt; we will ignore newly-created repositories, which is fine IMO,<br>
&gt; as I can&#39;t see us getting into such a situation from the commandline.<br>
<br>
</div>This is an API, not the commandline. &nbsp;We may have other clients that use<br>
it differently. &nbsp;We may extend the commandline later.<br>
<br>
It does not make sense to write fragile code when it&#39;s just as easy to<br>
write robust code.</blockquote><div><br>fair enough. sorry. done: using &#39;repo&#39; now.<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

&gt; # Bazaar merge directive format 2 (Bazaar 0.90)<br>
&gt; # revision_id: amanic@gmail.com-20090206014740-6gbah25yvrkocm6t<br>
&gt; # target_branch: ../bzr.dev/<br>
<br>
^^^ Please set the public_branch for your local mirror</blockquote><div><br>eish &lt;\me scratches head&gt;. `bzr send` seems to be a black art <br>with this public_branch location that I just don&#39;t seem to get right :(&nbsp; <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;">


&gt; === modified file &#39;bzrlib/builtins.py&#39;<br>
&gt; --- bzrlib/builtins.py &nbsp; &nbsp; &nbsp; &nbsp;2009-02-02 05:43:13 +0000<br>
&gt; +++ bzrlib/builtins.py &nbsp; &nbsp; &nbsp; &nbsp;2009-02-05 23:31:14 +0000<br>
&gt; @@ -4851,7 +4851,11 @@<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39; checkout (with no local history).&#39;,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; standalone=&#39;Reconfigure to be a standalone branch &#39;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;(i.e. stop using shared repository).&#39;,<br>
&gt; - &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; use_shared=&#39;Reconfigure to use a shared repository.&#39;),<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; use_shared=&#39;Reconfigure to use a shared repository.&#39;,<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; with_trees=&#39;Reconfigure repository to create &#39;<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;working trees on branches by default&#39;,<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; with_no_trees=&#39;Reconfigure repository to not create &#39;<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;working trees on branches by default&#39;),<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Option(&#39;bind-to&#39;, help=&#39;Branch to bind checkout to.&#39;,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;type=str),<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Option(&#39;force&#39;,<br>
&gt; @@ -4877,6 +4881,12 @@<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reconfiguration = reconfigure.Reconfigure.to_use_shared(directory)<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;elif target_type == &#39;standalone&#39;:<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reconfiguration = reconfigure.Reconfigure.to_standalone(directory)<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;elif target_type == &#39;with-trees&#39;:<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reconfiguration = reconfigure.Reconfigure.set_repository_trees(<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;directory, True)<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;elif target_type == &#39;with-no-trees&#39;:<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reconfiguration = reconfigure.Reconfigure.set_repository_trees(<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;directory, False)<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reconfiguration.apply(force)<br>
<br>
^^^ It doesn&#39;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>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

&gt; === modified file &#39;bzrlib/errors.py&#39;<br>
&gt; --- bzrlib/errors.py &nbsp;2009-01-27 05:04:43 +0000<br>
&gt; +++ bzrlib/errors.py &nbsp;2009-02-05 23:31:14 +0000<br>
&gt; @@ -2744,6 +2744,18 @@<br>
&gt; &nbsp; &nbsp; &nbsp;_fmt = &quot;&#39;%(display_url)s&#39; is already standalone.&quot;<br>
&gt;<br>
&gt;<br>
&gt; +class AlreadyWithTrees(BzrDirError):<br>
&gt; +<br>
&gt; + &nbsp; &nbsp;_fmt = &quot;Shared repository &#39;%(display_url)s&#39; already creates &quot; \<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;working trees.&quot;<br>
<br>
We generally use parentheses to split lines, e.g.:<br>
<br>
 &nbsp; &nbsp;_fmt = (&quot;Shared repository &#39;%(display_url)s&#39; already creates&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot; working trees.&quot;)</blockquote><div><br>done.<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&gt; === modified file &#39;bzrlib/tests/test_reconfigure.py&#39;<br>
&gt; --- bzrlib/tests/test_reconfigure.py &nbsp;2008-04-25 22:16:00 +0000<br>
&gt; +++ bzrlib/tests/test_reconfigure.py &nbsp;2009-01-08 08:13:29 +0000<br>
&gt; @@ -377,3 +377,33 @@<br>
&gt; &nbsp; &nbsp; &nbsp;def test_unsynced_branch_to_lightweight_checkout_forced(self):<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reconfiguration = self.make_unsynced_branch_reconfiguration()<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reconfiguration.apply(force=True)<br>
&gt; +<br>
&gt; + &nbsp; &nbsp;def make_repository_with_without_trees(self, with_trees):<br>
<div class="Ih2E3d">&gt; + &nbsp; &nbsp; &nbsp; &nbsp;repo = self.make_repository(&#39;repo&#39;, shared=True)<br>
</div>&gt; + &nbsp; &nbsp; &nbsp; &nbsp;repo.set_make_working_trees(with_trees)<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;return repo<br>
&gt; +<br>
&gt; + &nbsp; &nbsp;def test_make_with_trees(self):<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;repo = self.make_repository_with_without_trees(False)<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;reconfiguration = reconfigure.Reconfigure.set_repository_trees(<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;repo.bzrdir, True)<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;reconfiguration.apply()<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;self.assertIs(True, repo.make_working_trees())<br>
&gt; +<br>
&gt; + &nbsp; &nbsp;def test_make_without_trees(self):<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;repo = self.make_repository_with_without_trees(True)<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;reconfiguration = reconfigure.Reconfigure.set_repository_trees(<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;repo.bzrdir, False)<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;reconfiguration.apply()<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;self.assertIs(False, repo.make_working_trees())<br>
&gt; +<br>
&gt; + &nbsp; &nbsp;def test_make_with_trees_already_with_trees(self):<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;repo = self.make_repository_with_without_trees(True)<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;self.assertRaises(errors.AlreadyWithTrees,<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reconfigure.Reconfigure.set_repository_trees, repo.bzrdir, True)<br>
<br>
You should also test the text of the error, like so:<br>
<br>
 &nbsp; &nbsp;e = self.assertRaises(errors.AlreadyWithTrees,<br>
 &nbsp; &nbsp; &nbsp; &nbsp;reconfigure.Reconfigure.set_repository_trees, repo.bzrdir, True)<br>
 &nbsp; &nbsp;self.assertEqual(&#39;Already has trees!&#39;, str(e))</blockquote><div><br>done for both tests (with and without).<br>&nbsp;<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

&gt; +<br>
&gt; + &nbsp; &nbsp;def test_make_without_trees_already_no_trees(self):<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;repo = self.make_repository_with_without_trees(False)<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;self.assertRaises(errors.AlreadyWithNoTrees,<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reconfigure.Reconfigure.set_repository_trees, repo.bzrdir, False)<br>
&gt; +<br>
<br>
You also need to test the case where errors.ReconfigurationNotSupported<br>
is raised.</blockquote><div>&nbsp;</div></div>done.<br><br clear="all">thanks a lot for the review and spoon feeding me the fixes:)<br>-- <br>&lt;| regards<br>U| Marius<br>H| &lt;&gt;&lt; <br>