<br><br><div><span class="gmail_quote">On 11/6/06, <b class="gmail_sendername">John Arbash Meinel</b> <<a href="mailto:john@arbash-meinel.com">john@arbash-meinel.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
-----BEGIN PGP SIGNED MESSAGE-----<br>Hash: SHA1<br><br><br>I highly recommend learning to write tests along with code. I'm not 100%<br>dedicated to test-driven yet, but test-as-you-go is really nice.<br>Test-driven can be really good too, I just don't always use it.
<br>(Basically, to know your code works, you have to run it anyway, so you<br>might as well put that in a real test, and then in the future you will<br>be aware if that test ever fails).</blockquote><div><br>I completely aggree with you. I would have liked started with
<br>writing tests, but i did the patch more for myself in the first place.<br>I will write the tests as soon as possible.<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;">
2) We generally submit patches as text files (not .zip, etc) because<br>that way we can review them inside an email, rather than downloading it,<br>unzipping it, opening another editor, and the copying code chunks back<br>
to do comments.</blockquote><div><br>will comply next time<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;">3) If you read HACKING, you can see some of our style guides, but the
<br>important ones are:<br><br> 1) Use spaces, not tabs to indent<br> 2) Wrap lines at 79 characters</blockquote><div><br>whooops. i thought i did a '%s/\t/ /g' before commit .... <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;">
4) You changed the parameter 'to_name' to 'to_dir'. I agree that it is<br>more descriptive, but because in python any parameter can be accessed by<br>its' name, we have to maintain API compatibility. (eg<br>move(from_paths=[], to_name='foo'))
<br><br>However, we can do this:<br><br>def move(self, from_paths, to_dir=None, after=False, **kwargs):<br>...<br><br>if to_dir is None:<br> to_name = kwargs.get('to_name', None)<br> if to_name is None:<br> raise ? ('You must supply a target directory')
<br> else:<br> symbol_versioning.warn('The parameter to_name was deprecated'<br> ' in version 0.13. Use to_dir instead',<br> DeprecationWarning)<br> to_dir = to_name
<br><br><br>I'm not sure what the exact exception should be. Python would raise an<br>TypeError if you didn't supply a required argument. Which seems good<br>enough here. It is a programmer error, not a runtime error. (We
<br>generally avoid raising builtin errors, but in this case it makes sense)</blockquote><div><br>i will fix it. <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;">
5) This section:<br>+ tuple = {}<br>+ tuple['from_rel'] = from_rel<br>+ tuple['from_id'] = from_id<br>+ tuple['from_tail'] = from_tail<br>+ tuple['from_parent_id'] = from_parent_id
<br>+ tuple['to_rel'] = to_rel<br>+ tuple['to_tail'] = from_tail # from_tail == to_tail<br>+ tuple['to_parent_id'] = to_dir_id<br>+ from_to_tuples.append(tuple)<br><br>First, you call it a 'tuple' but it is a dictionary. (Python has a tuple
<br>type (1, 2, 3))<br><br>Second, PEP8 requests that you don't add whitespace before your '='<br>sign. I understand why you like it, but for consistency (and to prevent<br>people going back and forth changing this sort of thing) we've decided
<br>to follow PEP8's recommendations.</blockquote><div><br>What is PEP8 ? <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;">Third, I think you have enough stuff going on here that a real object
<br>would be better than a dictionary. We won't be creating so many of them<br>that a dictionary performance would matter. And I think it ends up being<br>clearer. And if you want to keep the naming, you still can, it just becomes:
<br><br>class _RenameEntry(object):<br><br> def __init__(self, from_rel, from_id, from_tail, from_parent_id,<br> to_rel, to_tail, to_parent_id):<br> self.from_rel = from_rel<br>...<br> self.only_change_inv
= None<br><br>...<br><br> entry = _RenamEntry(from_rel=from_rel,<br> from_id=from_id,<br> from_tail=from_tail,<br> ...<br> )</blockquote>
<div><br>seems like i have coded too much Ruby and not enough Python lately :-)<br>Dictionaries instead of ValueObjects are overused in Ruby.<br>Will change 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;">
6) All of the mutter() statements should be change:<br>+ mutter(" from_id {%s}" % from_id)<br>+ mutter(" from_rel %r" % from_rel)<br>+ mutter(" to_rel %r" % to_rel)
<br>+ mutter(" to_dir %r" % to_dir)<br>+ mutter(" to_dir_id {%s}" % to_dir_id)<br>+<br><br>This wasn't your bug, they were already incorrect. But at the least,<br>these should be:<br>
+ mutter(" from_id {%s}", from_id)<br>+ mutter(" from_rel %r", from_rel)<br>+ mutter(" to_rel %r", to_rel)<br>+ mutter(" to_dir %r", to_dir)
<br>+ mutter(" to_dir_id {%s}", to_dir_id)<br>+<br><br>Otherwise if there was a '%' symbol in one of the filenames, it would<br>cause mutter() to puke, because mutter() also does a string expansion<br>with the arguments. (Mutter should be updated to not puke, but this is
<br>still incorrect).<br><br>Further, I prefer to see stuff like this in a single call, so something<br>like:<br><br>mutter('rename one: {%s}\n'<br> ' from rel: %r\n'<br> ' to_rel: %r\n'<br> ' to_dir: %r\n'
<br> ' to_dir_id: {%s}\n',<br> from_id, from_rel, to_rel, to_dir, to_dir_id)</blockquote><div><br>Will change it, too.<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;">
7) I also discovered that your bundle used 'dos' line endings (CRLF).<br>This is a bug with how we interact with Windows (win defaults to setting<br>stdin/stdout/etc as text mode, when we expect binary mode). But it means
<br>that you should use 'bzr bundle --output=filename'</blockquote><div><br>Can you please update the 'Giving Back' document accordingly?<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;">
I hope this isn't more feedback than you wanted. I think the general<br>flow of what you did was good, just some tweaks to make it fit with our<br>coding style, etc.</blockquote><div><br>No. That is exactly what i wanted. We are talking about consistency here. That
<br>is vital to every software project that has to be maintained for the next two or three<br>decades (and that is the plan, isn't it ;-))<br><br>Thank you for taking the time.<br><br>Ciao,<br> Steffen<br><br></div><br></div>