I&#39;d like this in 1.12, so I gave it a go.<br><br><div class="gmail_quote">2009/1/19 Aaron Bentley <span dir="ltr">&lt;<a href="mailto:aaron@aaronbentley.com">aaron@aaronbentley.com</a>&gt;</span><br><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">
Matthew D. Fuller wrote:<br>
</div>&gt;</blockquote><div>... <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Actually, considering the change is just<br>
Repository.set_make_working_trees, it might be simpler to just invoke it<br>
directly.</blockquote><div><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"><br>
&gt; I did add a test that --with-no-trees doesn&#39;t screw with an existing<br>
&gt; working tree (the rewrite should make that impossible anyway). &nbsp;I&#39;m<br>
&gt; not real happy with the test; it sorta takes a long stroll around the<br>
&gt; garden to check if a door it just opened is open. &nbsp;There has to be a<br>
&gt; less absurd way of writing it, but that&#39;s far past my competence.<br>
<br>
</div>Well, you can skip some of the blackbox tests. &nbsp;The blackbox tests<br>
should prove that it works at all, not duplicate the unit tests.</blockquote><div><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 messages.<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; === modified file &#39;bzrlib/reconfigure.py&#39;<br>
&gt; --- bzrlib/reconfigure.py &nbsp; &nbsp; 2008-04-24 04:58:42 +0000<br>
&gt; +++ bzrlib/reconfigure.py &nbsp; &nbsp; 2009-01-19 08:48:21 +0000<br>
&gt; @@ -24,9 +24,10 @@<br>
&gt;<br>
&gt; &nbsp;class Reconfigure(object):<br>
&gt;<br>
&gt; - &nbsp; &nbsp;def __init__(self, bzrdir, new_bound_location=None):<br>
&gt; + &nbsp; &nbsp;def __init__(self, bzrdir, new_bound_location=None, with_trees=None):<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.bzrdir = bzrdir<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.new_bound_location = new_bound_location<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;self.with_trees = with_trees<br>
<br>
What is the purpose of this variable? &nbsp;AFAICT, it is only used in<br>
set_repository_trees, and it is set there also.</blockquote><div><br>removed.<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;try:<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.repository = self.bzrdir.find_repository()<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;except errors.NoRepositoryPresent:<br>
&gt; @@ -62,6 +63,8 @@<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self._create_tree = False<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self._create_repository = False<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self._destroy_repository = False<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;self._set_with_trees = False<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;self._set_with_no_trees = False<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp;@staticmethod<br>
&gt; &nbsp; &nbsp; &nbsp;def to_branch(bzrdir):<br>
&gt; @@ -140,6 +143,25 @@<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;raise errors.AlreadyStandalone(bzrdir)<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return reconfiguration<br>
&gt;<br>
&gt; + &nbsp; &nbsp;@classmethod<br>
&gt; + &nbsp; &nbsp;def set_repository_trees(klass, bzrdir, with_trees):<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;&quot;&quot;&quot;Adjust a repository&#39;s working tree presense default&quot;&quot;&quot;<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;reconfiguration = klass(bzrdir, with_trees=with_trees)<br>
<br>
You don&#39;t need to pass with_trees in-- just use with_trees instead of<br>
reconfiguration.with_trees.</blockquote><div><br>done<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; + &nbsp; &nbsp; &nbsp; &nbsp;if not reconfiguration.repository.is_shared():<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;raise errors.ReconfigurationNotSupported(reconfiguration.bzrdir)<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;if reconfiguration.with_trees is True and \<br>
<br>
Please use a boolean test like<br>
<br>
if reconfiguration.with_trees</blockquote><div><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;">&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;not reconfiguration.repository.make_working_trees():<br>

&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reconfiguration._set_with_trees = True<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;elif reconfiguration.with_trees is False and \<br>
<br>
Again, use elif not reconfiguration.with_trees</blockquote><div><br>done<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; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reconfiguration.repository.make_working_trees():<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reconfiguration._set_with_no_trees = True<br>
<br>
Except, why not just use reconfiguration.with_trees directly in<br>
Reconfiguration.apply?</blockquote><div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
i.e.<br>
<br>
if self.with_trees is not None:<br>
 &nbsp; &nbsp;if self.repository.set_make_working_trees(self.with_trees)</blockquote><div><br>changes are now done in set_repository_trees() directly.<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; @@ -302,3 +325,7 @@<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local_branch.bind(branch.Branch.open(bind_location))<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if self._destroy_repository:<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.bzrdir.destroy_repository()<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;if self._set_with_trees:<br>
<div class="Ih2E3d">&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.repository.set_make_working_trees(True)<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;if self._set_with_no_trees:<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.repository.set_make_working_trees(False)<br>
<br>
</div>self.repository refers to the current repository, but won&#39;t refer to a<br>
newly-created repository. &nbsp;You&#39;ll want to use the local variable &#39;repo&#39;<br>
instead.</blockquote><div><br>AFAICT,&nbsp; 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&#39;t see us getting into such a situation from the commandline.<br><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; + &nbsp; &nbsp;def test_make_without_trees_leaves_tree_alone(self):<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;# There has to be a better way of doing this...<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;repo = self.make_repository(&#39;repo&#39;, shared=True)<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;branch = self.make_branch(&#39;repo/branch&#39;)<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;self.run_bzr(&#39;reconfigure --use-shared&#39;,<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;working_dir=&#39;repo/branch&#39;)<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;tree = branch.bzrdir.create_workingtree()<br>
<br>
Use BzrDir.create_branch_convenience instead of creating the branch and<br>
tree and then making it use the shared repository.</blockquote><div><br>done, <br>well I created the repo first and then create_branch_convenience would put it in the repo.<br><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; + &nbsp; &nbsp; &nbsp; &nbsp;self.build_tree([&#39;repo/branch/foo&#39;])<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;tree.add(&#39;foo&#39;)<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;tree.commit(&#39;x&#39;)<br>
<br>
You don&#39;t have to commit-- you can just supply --force</blockquote><div><br>done<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; + &nbsp; &nbsp; &nbsp; &nbsp;self.run_bzr(&#39;reconfigure --with-no-trees&#39;,<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;working_dir=&#39;repo/branch&#39;)<br>
&gt; + &nbsp; &nbsp; &nbsp; &nbsp;self.failUnlessExists(&#39;repo/branch/foo&#39;)<br>
<br>
But this whole thing should be a unit test so that you know that<br>
workingtree.WorkingTree.open works at the end.</blockquote><div>&nbsp;</div><div>I do WorkingTree.open at the end now too, would that satisfy you?<br>&nbsp;</div></div><br>&lt;| regards<br>U| Marius<br>H| &lt;&gt;&lt; <br>