hi, <br><br>here goes try number 4<br>see attached zipped bundle, and the total diff for easy reviewing.<br><br><br><div><span class="gmail_quote">On 1/3/07, <b class="gmail_sendername">Aaron Bentley</b> <<a href="mailto:aaron.bentley@utoronto.ca" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
aaron.bentley@utoronto.ca
</a>> wrote:</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>=== modified file 'bzrlib/builtins.py' (properties changed)<br><br>^^^ I don't think it makes sense to set builtins.py executable.</blockquote><div><br>I don't know how this happened, I obviously wasn't on the lookout for this sort of thing when committing, but I've undid all the files that became executable (hope I didn't stuff up again!) :
<br>bzrlib/builtins.py <br>bzrlib/tests/blackbox/test_mv.py <br>bzrlib/tests/workingtree_implementations/test_workingtree.py <br>bzrlib/workingtree.py<br><br></div><br><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>+class FilesExist(PathError):<br>+ """Used when reporting that files do exist"""<br>+<br>+ _fmt = "File%(plural)s exist: %(paths_as_string)s%(extra)s"
<br>+<br>+ def __init__(self, paths, extra=None):<br>+ # circular import<br>+ from bzrlib.osutils import quotefn<br>+ BzrError.__init__(self)<br>+ self.paths = paths<br>+ self.paths_as_string
= ' '.join(paths)<br>+ if extra:<br>+ self.extra = ': ' + str(extra)<br>+ else:<br>+ self.extra = ''<br>+ if len(paths) > 1:<br>+ self.plural
= 's'<br>+ else:<br>+ self.plural = ''<br><br>^^^ I'm dubious about trying to generate correct English plurals for<br>error strings -- we've always just done "File(s) exist". You don't have
<br>to change this, it's just my reaction.</blockquote><div><br>I was also ok with file(s), but in the end it is more user friendly to handle plurals properly. <br>John sort of complained about this, and since I think this exception is suited to one or more
<br>files, I thought this is the best way to address this.<br>John's complaint:<br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote"><span>
> self.run_bzr_error(</span><br><span>> - ["^bzr: ERROR: can't rename: both, old name .* and new name .*"</span><br><span>> - " exist. Use option '--after' to force rename."],
</span><br><span></span><div style="direction: ltr;">> + ["^bzr: ERROR: File\(s\) exist: .+ .+: can't rename."<br></div><div style="direction: ltr;"><span>> + " Use option '--after' to force rename."],
<br><br></span></div><div style="direction: ltr;">^- You shouldn't need "File(s)" it should just be Files, since you know<br>there are 2 files. Though it makes me wonder if the right exception is<br>being used.
</div></blockquote><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;">@@ -147,3 +152,151 @@<br> self.run_bzr('mv', 'c/b', 'b')
<br> tree = workingtree.WorkingTree.open('.')<br> self.assertEqual('b-id', tree.path2id('b'))<br>+<br>+ def test_mv_already_moved_file(self):<br>+ """a is in repository, b does not exist. User does
<br>+ mv a b; bzr mv a b"""<br>....<br>
Finally, I'm not sure what the point of committing the files is. 'bzr<br>mv' doesn't and shouldn't care whether or not the files have been committed.</blockquote><div>ok I've removed them, I think it was thought that they might be handled differently.
<br>the tests pass without them and if you assume they should be handled the <br>the same, the commits are not really needed.<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
- --- bzrlib/tests/workingtree_implementations/test_workingtree.py<br>2006-09-10 19:04:48 +0000<br>+++ bzrlib/tests/workingtree_implementations/test_workingtree.py<br>2007-01-03 02:46:14 +0000<br>@@ -681,3 +681,50 @@
<br> tree.add, [u'a\u030a'])<br> finally:<br> osutils.normalized_filename = orig<br>+ def test_move_deprecated_wrong_call(self):<br>+ """tree.move has the deprecated parameter 'to_name'.
<br>+ It has been replaced by 'to_dir' for consistency.<br>+ Test the new API using wrong parameter"""<br>+ self.build_tree(['a1', 'sub1/'])<br>+ tree =
self.make_branch_and_tree
('.')<br>+ tree.add(['a1', 'sub1'])<br>+ tree.commit('initial commit')<br>+ self.assertRaises(TypeError, tree.move, ['a1'],<br>+ to_this_parameter_does_not_exist='sub1',
<br>+ after=False)<br><br>^^^ This is probably superfluous with the following test. I must admit<br>I thought you were obsoleting (not just deprecating) the parameter, at<br>first.<br><br>+ def test_move_deprecated_deprecated_call(self):
</blockquote><div>(This was done by Steffen Eichenberg, not me. <br>I'm just trying to fix it up to a commitable state remember,<br>I suppose thats makes me responsible.)<br>Is it ok if I leave this, it seems to be there for a good cause:
<br>test that we can now and in the future use the named and<br>unnamed api of .move<br><br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
+ This is the new mode introduced<br>+ in version 0.13.<br><br>More like version 0.14. I think. Hey, who's flying this plane, anyway?<br></blockquote><div>More like version 0.15 :(<br>what plane? <br>
btw is it good to have references this in the code?<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> This returns a list of (from_path, to_path) pairs for each
<br>- - <span id="__firefox-findbar-search-id" style="padding: 0pt; background-color: yellow; color: black; display: inline; font-size: inherit;">entry</span> that is moved.<br>+ <span id="__firefox-findbar-search-id" style="padding: 0pt; background-color: yellow; color: black; display: inline; font-size: inherit;">
entry</span>, that is moved.<br><br>^^^ The original phrasing is correct.<br>As code: [pairs(<span id="__firefox-findbar-search-id" style="padding: 0pt; background-color: yellow; color: black; display: inline; font-size: inherit;">
entry</span>) for <span id="__firefox-findbar-search-id" style="padding: 0pt; background-color: yellow; color: black; display: inline; font-size: inherit;">entry</span> in moved_entries()]
</blockquote><div>I could have sworn one of the previous reviewers requested this,<br>but i could not find it so I must be delusional.<br> </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
+ # determine which move mode to use. checks also for movability<br>+ rename_entries = self._determine_mv_mode(rename_entries, after)<br>+<br>+ # move pairs.</blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
^^^ What does "move pairs" mean?<br></blockquote><div>
You're asking me?<br>
I don't know, so I just removed it. </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> original_modified = self._inventory_is_modified
<br> try:<br>- - if len(from_paths):<br>+ if len(from_paths):<br><br>^^^ All this does is insert a trailing space. Not an improvement :-)
</blockquote><div><br>very funny.<br>I just can't win: If I set my editor to remove those pesky trailing whitespace<br>automatically you complain that I remove them. if I don't, you complain <br>that I add them.
<br>I think after this thing is merged I should start looking at doing a patch which:<br>1) removes all the trailing white space once and for all and<br>2) introduce a test which checks that nobody violates this ever again.
<br><br>And I might also write a plugin which warns you that you are<br>adding trailing white space when you commit (even failing the commit if you choose). <br>So that this sort of thing is caught earlier.<br>It can maybe also add a command similar to shelve which traverses the
<br>changes which have not been committed yet and asks you for every bunch of<br>trailing ws it finds, if you want to remove it and does it for you.<br><br>This plugin would be usefull for other projects too, like the projects at my dayjob.
<br>(where we also have differences of oppinion about trailing whitespace)<br><br>I also removed all the trailing white space this bundle would have introduced.<br>I see that some of the latest commits still introduce new trailing white space,
<br>when is it going to stop?<br><br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">+ for <span id="__firefox-findbar-search-id" style="padding: 0pt; background-color: yellow; color: black; display: inline; font-size: inherit;">
entry</span> in rename_entries:<br>+ try:<br>+ self._move_<span id="__firefox-findbar-search-id" style="padding: 0pt; background-color: yellow; color: black; display: inline; font-size: inherit;">
entry</span>(<span id="__firefox-findbar-search-id" style="padding: 0pt; background-color: yellow; color: black; display: inline; font-size: inherit;">entry</span>)<br>+ except OSError, e:<br>+ self._rollback_move(moved)
<br>+ raise
errors.BzrRenameFailedError(<span id="__firefox-findbar-search-id" style="padding: 0pt; background-color: yellow; color: black; display: inline; font-size: inherit;">entry</span>.from_rel,<br><span id="__firefox-findbar-search-id" style="padding: 0pt; background-color: yellow; color: black; display: inline; font-size: inherit;">
entry</span>.to_rel,<br>+ e[1])<br>+ except errors.BzrError, e:<br>+ self._rollback_move(moved)<br>+ raise<br><br>^^^ Is it possible to catch more specific errors here? BzrError and
<br>OSError are very broad.</blockquote><div>(Again I didn't write this, so don't be too hard on me)<br>I think its ok, as we just want to rollback and raise it again.<br>It is done like that elsewere in the file too.
<br></div></div><br><br>regards<br>marius.<br><br>-- <br><br><br><br>white space is overrated