[MERGE][Bug #48623] If versioned files match a given ignore pattern, display a warning containing the files in question

Daniel Watkins D.M.Watkins at warwick.ac.uk
Wed Aug 29 10:53:18 BST 2007


On Tue, 2007-08-28 at 22:26 -0400, Aaron Bentley wrote:
> The implementation looks fine, but I'd like to see a test showing that 
> the warning only lists files that match new globs, not globs that were 
> already in the .bzrignore.
Done in attached.

-- 
Daniel Watkins (Odd_Bloke) <D.M.Watkins at warwick.ac.uk>
University of Warwick Christian Focus President
University of Warwick Computing Society WUGLUG Liaison Officer
-------------- next part --------------
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: d.m.watkins at warwick.ac.uk-20070829094837-\
#   xunde9qmpsz8btru
# target_branch: file:///home/daniel/devel/bzr/bzr.dev/
# testament_sha1: 278641b12163dc8ff8074d86a55423c01914eab3
# timestamp: 2007-08-29 11:48:48 +0200
# base_revision_id: pqm at pqm.ubuntu.com-20070824133750-r25v5g25g1flggy6
# 
# Begin patch
=== modified file 'bzrlib/builtins.py'
--- bzrlib/builtins.py	2007-08-21 01:32:29 +0000
+++ bzrlib/builtins.py	2007-08-28 11:14:27 +0000
@@ -1958,6 +1958,19 @@
         if not tree.path2id('.bzrignore'):
             tree.add(['.bzrignore'])
 
+        ignored = globbing.Globster(name_pattern_list)
+        matches = []
+        tree.lock_read()
+        for entry in tree.list_files():
+            id = entry[3]
+            if id is not None:
+                filename = entry[0]
+                if ignored.match(filename):
+                    matches.append(filename.encode('utf-8'))
+        tree.unlock()
+        if len(matches) > 0:
+            print "Warning: the following files are version controlled and" \
+                  " match your ignore pattern:\n%s" % ("\n".join(matches),)
 
 class cmd_ignored(Command):
     """List ignored files and the patterns that matched them.

=== modified file 'bzrlib/tests/blackbox/test_ignore.py'
--- bzrlib/tests/blackbox/test_ignore.py	2007-06-27 19:13:50 +0000
+++ bzrlib/tests/blackbox/test_ignore.py	2007-08-29 09:48:37 +0000
@@ -117,3 +117,37 @@
         self.assertContainsRe(out, 'CVS')
         self.assertEqual('', err)
 
+    def test_ignore_versioned_file(self):
+        tree = self.make_branch_and_tree('.')
+        self.build_tree(['a','b'])
+        tree.add('a')
+
+        # test a single versioned file
+        out, err = self.run_bzr('ignore a')
+        self.assertEqual(out, 
+                         "Warning: the following files are version controlled"\
+                         " and match your ignore pattern:\na\n")
+
+        # test a single unversioned file
+        out, err = self.run_bzr('ignore b')
+        self.assertEqual(out, '')
+
+        # test wildcards
+        tree.add('b')
+        out, err = self.run_bzr('ignore *')
+        self.assertEqual(out, 
+                         "Warning: the following files are version controlled"\
+                         " and match your ignore pattern:\n.bzrignore\na\nb\n")
+
+    def test_ignored_versioned_file_matching_new_pattern(self):
+        tree = self.make_branch_and_tree('.')
+        self.build_tree(['a', 'b'])
+        tree.add(['a', 'b'])
+        self.run_bzr('ignore *')
+
+        # If only the given pattern is used then only 'b' should match in
+        # this case.
+        out, err = self.run_bzr('ignore b')
+        self.assertEqual(out, 
+                         "Warning: the following files are version controlled"\
+                         " and match your ignore pattern:\nb\n")

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWekg8k0ABvn/gERVQgBb////
dqMAjr////BgC5z5RVAAAAAqgAAUAAAABxkyaaYTIyBgRiaMEYQaNMAAhxkyaaYTIyBgRiaMEYQa
NMAAhxkyaaYTIyBgRiaMEYQaNMAAglNElPJT8UehDQaNM0k09TRp6jTT1D1GA0AHGTJpphMjIGBG
JowRhBo0wACBUkgTTQCNBNMjFPUeiNNAp6m0g0PRGPSlAAbtgbu8YoOCZYsoSEHZpOKfILxhNTal
F5jtpJ0abU7N8ReC0KHQtD/B222vA0AIGqBArKrb+qtLYl8icPhTnqWXl7ruwqaWmyRH2SoEykR/
949Bh9KfVn1MR/wbiipVVHbx/7hswKAUCYup4HNsvzOSJF8LK+oR5Bg+VeoOe/ckUar5ngc/LFd0
jDLNkXMT9zsuuNX9tDA/zgrP+2hX168tRbbsx/ra/hjabtRca9t/45aXabstRg1GK4xpVKorcmee
10NtYrZDVu9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XtiXsrFmcSy5MkZOOEGhia4yyndEamSEzS+iWsWkjCXEr29btjz/etNfHxuNRhJr
F1RJ/H8y0apfgVBdi0ieERaFv50S7h6/gdh7zZjyMfR4F3+hjHieJ7yXeFRWQ4Lt4W73d+c/bNv/
LabRRr2Jz8YfWTtRvT9E/c8+8rXyK6PdF/h5Qs2yjGJ3JlaFFSbKdtThDOpcYCdvSfiWOZRLjTHd
pTSF4zjXFXY4hhCXUME6YxkheXUUo/LwMb6Oq1rWx/O+/+LJilGIotJC34DLq83mnJVG/3ZFDiLz
aewokqLjQm0bDCyqVVUTs1RLXZ3a03ZcsFqVTeK8j4H1GA3mGoofmKPlgkuLuBOR6PapaRrNtibt
gsL09dJEbX8jC2yJnYldbrKmFL460qYYrDSidRrFp9V5fR/JSqpSuUq3zPdPde13+3aMZIdPmZxX
Yl+E5Z5FqHv+NvD3cP1nJ0kziq7HEHaj3I7NIXtmuFtW2SHGQfqc5IX5R8UfzLO1GZPgnvao6S24
woXXnCWL7k1o0K60484xOwf/i7kinChIdJB5JoA=
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070829/2489c4d0/attachment.pgp 


More information about the bazaar mailing list