I have just copied over the fixes by Kent Gibson and made this new changeset.<br><br><div><span class="gmail_quote">On 10/11/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>Cheuksan Edward Wang wrote:<br>> OK. Here is the third try.<br>><br>...<br><br>> - def run(self, name_pattern=None, old_default_rules=None):<br>> + def run(self, name_pattern_list=None, old_default_rules=None):
<br>> from bzrlib.atomicfile import AtomicFile<br>> if old_default_rules is not None:<br>> # dump the rules and exit<br>> for pattern in ignores.OLD_DEFAULTS:<br>> print pattern
<br>> return<br>> - if name_pattern is None:<br>> - raise BzrCommandError("ignore requires a NAME_PATTERN")<br>> + if name_pattern_list is None or name_pattern_list == []:
<br>> + raise BzrCommandError("ignore requires at least one NAME_PATTERN or --old-default-rules")<br><br>^- Almost there. But now you are wider than 79 characters, so you need<br>to break this into two lines:
<br> raise BzrCommandError("ignore requires at least one"<br> " NAME_PATTERN or --old-default-rules")<br><br>should be about right.<br><br>...<br><br>> === modified file bzrlib/tests/blackbox/test_ignore.py //
last-changed:wang@ubu<br>> ... ntu-20061010073621-c17937e940897fdc<br>> --- bzrlib/tests/blackbox/test_ignore.py<br>> +++ bzrlib/tests/blackbox/test_ignore.py<br>> @@ -74,6 +74,11 @@<br>> self.assertEquals
(self.capture('unknowns'), '')<br>> self.assertEquals(file('.bzrignore', 'rU').read(), '*.blah\ngarh\n')<br><br>v- 3 small problems with this one<br><br>1) self.capture('unknowns') isn't doing anything here, because the
<br>unknown list hasn't changed.<br><br>2) self.check_file_contents() is a better function to call, rather than<br>.read() and assertEquals(). I realize you were just copying the other<br>call, but we are trying to avoid file(...).read() or file(...).write(),
<br>because they can sometimes leave open file handles on Windows, which<br>means we can't clean up properly.<br><br>3) It really should be a separate test, rather than adding something to<br>this test.<br><br>> + # 'ignore' works with multiple arguments
<br>> + self.runbzr('ignore a b c')<br>> + self.assertEquals(self.capture('unknowns'), '')<br>> + self.assertEquals(file('.bzrignore', 'rU').read(), '*.blah\ngarh\na\nb\nc\n')<br>> +<br>> def test_ignore_old_defaults(self):
<br>> out, err = self.run_bzr('ignore', '--old-default-rules')<br>> self.assertContainsRe(out, 'CVS')<br><br>Other than the wrapping, nothing really blocks this being merged. I'm<br>just trying to introduce you to some of the 'recommendations' that we
<br>try to follow. (A lot of this is covered in HACKING, but certainly not<br>everything (and probably not as much as should be there).<br><br>Also, I think we want to change AtomicFile(..., 'wt') to AtomicFile(...,<br>'wb').
<br><br>I realize that the file is human editable, so we might try to be nice<br>for the platform, but I don't think we want to have the line endings<br>change because a new ignore was added on a different platform. And we
<br>are trying to avoid recommending directly editing the file, since we<br>might switch to moving it away from being a directly versioned file.<br><br>I mostly mention it here, because it means your test doesn't need to<br>
open the file with 'rU', because the line endings would always be pure '\n'.<br>John<br>=:-><br>-----BEGIN PGP SIGNATURE-----<br>Version: GnuPG v1.4.5 (Darwin)<br>Comment: Using GnuPG with Mozilla - <a href="http://enigmail.mozdev.org">
http://enigmail.mozdev.org</a><br><br>iD8DBQFFLD7uJdeBCYSNAAMRAqhoAKCJ4oyRZec09HMYI3LNJRM4Ut0mzQCfRjgu<br>/kPT3J9AsQjXX6AYcIQbvIs=<br>=mUQt<br>-----END PGP SIGNATURE-----<br></blockquote></div><br>