[PATCH] stripping trailing slashes from ignore patterns (#4559)
Aaron Bentley
aaron.bentley at utoronto.ca
Wed Oct 11 23:24:35 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Kent Gibson wrote:
> Latest changes incorporating John Arbash Meinel's review comments for
> Cheuksan Edward Wang's ignore_multiple_3.patch (phew - say that 3
> times). This diff applies to that patch and fixes Cheuksan's few
> remaining problems as well as the corresponding problems in my patch.
> Cheuksan - sorry for the pre-emptive patch, but there is quite a bit of
> overlap.
>
> Used a diff format this time instead of a bundle. Is there any
> preference? The bundles seem to grow rather dramatically.
We like to preserve metadata, and bundles let us do that without needing
access to your branch. So if you're providing a diff rather than a
bundle, we like to also have a branch location that we can merge from.
In fact, right now, I'm not sure how to apply this patch in order to
review it or merge it. So a branch would be handy.
It seems like in the long term, bzr ignore should be able to handle
*files*, not just patterns, and then it would make sense to accept
absolute paths, (like 'bzr add' does). But this makes sense for now.
> === modified file 'bzrlib/ignores.py'
> --- bzrlib/ignores.py 2006-07-31 14:04:26 +0000
> +++ bzrlib/ignores.py 2006-10-11 14:44:08 +0000
> @@ -99,7 +99,7 @@
> """Read in all of the lines in the file and turn it into an ignore list"""
> ignored = set()
> for line in f.read().decode('utf8').split('\n'):
> - line = line.rstrip('\r\n')
> + line = line.rstrip('/\r\n')
> if not line or line.startswith('#'):
> continue
> ignored.add(line)
> @@ -163,6 +163,7 @@
> ignored = get_user_ignores()
> to_add = []
> for ignore in new_ignores:
> + ignore = ignore.rstrip('/')
> if ignore not in ignored:
> ignored.add(ignore)
> to_add.append(ignore)
It seems like we're stripping slashes in an awful lot of places. Since
get_user_ignores uses parse_ignore_file, isn't this redundant?
> + def test_ignore_no_arguments(self):
> + """'ignore' with no arguments returns an error"""
> + self.runbzr('init')
> + out, err = self.runbzr('ignore', retcode=3)
> + self.assertEqual(
> + 'bzr: ERROR: ignore requires at least one '
> + 'NAME_PATTERN or --old-default-rules\n', err)
> + self.assertEqual('', out)
^^^ not sure whether you're aware, but you can also do
run_bzr_error(('bzr: ERROR: ignore requires at least one '
'NAME_PATTERN or --old-default-rules\n',), 'ignore')
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFFLW8j0F+nu1YWqI0RAr2EAJ9eif3aEAB9gI06+FXP5KbhoJY/hwCdGAce
bqXyDl0DkTcD3+k1b3f8NAo=
=I8UQ
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list