Merge pull request #47 from RightBrain-Networks/bugfix/regexNewLines
BUGFIX: Fixed versioning with branch name commit description
This commit is contained in:
commit
2664efea0b
@ -19,7 +19,7 @@ NOT_MAIN_BRANCH = Exception('Not merging into a main branch')
|
||||
NO_GIT_FLOW = Exception('No git flow branch found')
|
||||
|
||||
# Important regex
|
||||
GET_COMMIT_MESSAGE = re.compile(r"Merge (branch|pull request) '?([^']+)'? (into|from) (?:'(.+)'|[^\/]+\/(.+))")
|
||||
GET_COMMIT_MESSAGE = re.compile(r"Merge (branch|pull request) '?([^']+)'? (into|from) (?:'(.+)'|[^\/]+\/([^\n\\]+))")
|
||||
|
||||
class SemVer(object):
|
||||
|
||||
|
@ -139,6 +139,13 @@ class TestGetCommitMessageRegex(unittest.TestCase):
|
||||
self.assertEqual(matches.group(2), "branch")
|
||||
else:
|
||||
self.assertTrue(False)
|
||||
def test_branch_in_message(self):
|
||||
matches = GET_COMMIT_MESSAGE.search(str(b'commit examplehash\nMerge: example\nAuthor: Test <test@nodomain.rightbrainnetworks.com>\nDate: Mon Jun 15 18:15:22 2020 -0400\n\n Merge pull request #45 from user/branch\n \n user/branch\n'))
|
||||
if matches:
|
||||
self.assertEqual(matches.group(4), None)
|
||||
self.assertEqual(matches.group(5), "branch")
|
||||
else:
|
||||
self.assertTrue(False)
|
||||
def test_non_merge_message(self):
|
||||
matches = GET_COMMIT_MESSAGE.search("Example unrelated commit message that should get 0 matches")
|
||||
self.assertEqual(matches, None)
|
||||
|
Loading…
Reference in New Issue
Block a user