diff tests/test_fetch_mappings.py @ 1402:94eb844fd4ab

tests: add test for regex and glob
author Sean Farley <sean.michael.farley@gmail.com>
date Mon, 24 Mar 2014 11:21:01 -0500
parents a17d8874a099
children 3a723188051e
line wrap: on
line diff
--- a/tests/test_fetch_mappings.py
+++ b/tests/test_fetch_mappings.py
@@ -209,6 +209,22 @@ class MapTests(test_util.TestBase):
         self.assert_('good-name' in branches)
         self.assertEquals(self.repo[2].branch(), 'default')
 
+    def test_branchmap_regex_and_glob(self):
+        repo_path = self.load_svndump('branchmap.svndump')
+        branchmap = open(self.branchmap, 'w')
+        branchmap.write("syntax:re\n")
+        branchmap.write("bad(.*) = good-\\1 # stuffy\n")
+        branchmap.write("glob:feat* = default\n")
+        branchmap.close()
+        ui = self.ui()
+        ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
+        commands.clone(ui, test_util.fileurl(repo_path),
+                       self.wc_path, branchmap=self.branchmap)
+        branches = set(self.repo[i].branch() for i in self.repo)
+        self.assert_('badname' not in branches)
+        self.assert_('good-name' in branches)
+        self.assertEquals(self.repo[2].branch(), 'default')
+
     def test_branchmap_tagging(self):
         '''test tagging a renamed branch, which used to raise an exception'''
         repo_path = self.load_svndump('commit-to-tag.svndump')