CI: Remove run-tests script
[fast-export.git] / plugins / branch_name_in_commit / __init__.py
blob311a84ca15c1c3b2dbb28b43373057a8d9031df5
1 def build_filter(args):
2 return Filter(args)
4 class Filter:
5 def __init__(self, args):
6 args = {arg: True for arg in args.split(',')}
7 self.start = args.pop('start', False)
8 self.end = args.pop('end', False)
9 self.sameline = args.pop('sameline', False)
10 self.skip_master = args.pop('skipmaster', False)
12 if self.sameline and not self.start:
13 raise ValueError("sameline option only allowed if 'start' given")
14 if args:
15 raise ValueError("Unknown args: " + ','.join(args))
17 def commit_message_filter(self, commit_data):
18 if not (self.skip_master and commit_data['branch'] == b'master'):
19 if self.start:
20 sep = b': ' if self.sameline else b'\n'
21 commit_data['desc'] = commit_data['branch'] + sep + commit_data['desc']
22 if self.end:
23 commit_data['desc'] = (
24 commit_data['desc'] + b'\n' + commit_data['branch']