Commits

Anonymous committed c2f8c5b

project: .hg pattern should not match .hgignore

  • Participants
  • Parent commits 1813358

Comments (0)

Files changed (2)

rope/base/resources.py

         re_pattern = pattern.replace('.', '\\.').\
                      replace('*', '[^/]*').replace('?', '[^/]').\
                      replace('//', '/(.*/)?')
-        re_pattern = '(.*/)?' + re_pattern + '(/.*)?'
+        re_pattern = '^(.*/)?' + re_pattern + '(/.*)?$'
         self.compiled_patterns.append(re.compile(re_pattern))
 
     def does_match(self, resource):

ropetest/projecttest.py

         myfile.create()
         self.assertEquals('', fscommands.log)
 
+    def test_ignored_resources_and_prefixes(self):
+        self.project = testutils.sample_project(
+            ignored_resources=['.hg'])
+        myfile = self.project.root.create_file('.hgignore')
+        self.assertFalse(self.project.is_ignored(myfile))
+
     def test_loading_config_dot_py(self):
         self.project = testutils.sample_project(ropefolder='.ropeproject')
         config = self.project.get_file('.ropeproject/config.py')