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> &lt;<a href="mailto:john@arbash-meinel.com">
john@arbash-meinel.com</a>&gt; 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>&gt; OK. Here is the third try.<br>&gt;<br>...<br><br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;def run(self, name_pattern=None, old_default_rules=None):<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;def run(self, name_pattern_list=None, old_default_rules=None):
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from bzrlib.atomicfile import AtomicFile<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if old_default_rules is not None:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# dump the rules and exit<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for pattern in ignores.OLD_DEFAULTS:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print pattern
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if name_pattern is None:<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raise BzrCommandError(&quot;ignore requires a NAME_PATTERN&quot;)<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if name_pattern_list is None or name_pattern_list == []:
<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raise BzrCommandError(&quot;ignore requires at least one NAME_PATTERN or --old-default-rules&quot;)<br><br>^- Almost there. But now you are wider than 79 characters, so you need<br>to break this into two lines:
<br>&nbsp;&nbsp; raise BzrCommandError(&quot;ignore requires at least one&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot; NAME_PATTERN or --old-default-rules&quot;)<br><br>should be about right.<br><br>...<br><br>&gt; === modified file bzrlib/tests/blackbox/test_ignore.py // 
last-changed:wang@ubu<br>&gt; ... ntu-20061010073621-c17937e940897fdc<br>&gt; --- bzrlib/tests/blackbox/test_ignore.py<br>&gt; +++ bzrlib/tests/blackbox/test_ignore.py<br>&gt; @@ -74,6 +74,11 @@<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.assertEquals
(self.capture('unknowns'), '')<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# 'ignore' works with multiple arguments
<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.runbzr('ignore a b c')<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.assertEquals(self.capture('unknowns'), '')<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.assertEquals(file('.bzrignore', 'rU').read(), '*.blah\ngarh\na\nb\nc\n')<br>&gt; +<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def test_ignore_old_defaults(self):
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out, err = self.run_bzr('ignore', '--old-default-rules')<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>=:-&gt;<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>