Commit 6f58df95 authored by Michal Čihař's avatar Michal Čihař

Factor out regexp processing to separate method

parent 93077375
......@@ -39,6 +39,14 @@ class Command(BaseCommand):
matches = maskre.match(path)
return matches.group(1)
def get_match_regexp(self, filemask):
'''
Prepare regexp for file matching
'''
match = fnmatch.translate(filemask)
match = match.replace('.*.*', '(.*.*)')
return re.compile(match)
def handle(self, *args, **options):
'''
Automatic import of project.
......@@ -49,10 +57,7 @@ class Command(BaseCommand):
# Read params
prjname, repo, branch, filemask = args
# Prepare regexp for file matching
match = fnmatch.translate(filemask)
match = match.replace('.*.*', '(.*.*)')
maskre = re.compile(match)
maskre = self.get_match_regexp(filemask)
# Try to get project
try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment