From 9a739029ec3e67b9dac835c39206aefee2ecd965 Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Thu, 2 Feb 2023 12:16:06 -0600 Subject: [PATCH] update regex to match all iterations (#6839) * update regex to match all iterations * convert to num to match all adapters * add comments, remove extra . * clarify with more comments * Update .bumpversion.cfg Co-authored-by: Nathaniel May --------- Co-authored-by: Nathaniel May # Conflicts: # .bumpversion.cfg --- .bumpversion.cfg | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 2d14f621472..ad2a19955f1 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,15 +1,21 @@ [bumpversion] -current_version = 1.2.4 -parse = (?P\d+) - \.(?P\d+) - \.(?P\d+) - ((?Pa|b|rc) - (?P
\d+)  # pre-release version num
-	)(\.(?P[a-z..0-9]+)
+current_version = 1.5.0a1
+
+# `parse` allows parsing the version into the parts we need to check.  There are some
+# unnamed groups and that's okay because they do not need to be audited.  If any part
+# of the version passed and does not match the regex, it will fail.
+# expected matches: `1.5.0`, `1.5.0a1`, `1.5.0a1.dev123457+nightly`
+# excepted failures: `1`, `1.5`, `1.5.2-a1`, `text1.5.0`
+parse = (?P[\d]+) # major version number
+	\.(?P[\d]+) # minor version number
+	\.(?P[\d]+) # patch version number
+	(((?Pa|b|rc) # optional pre-release type
+	?(?P[\d]+?)) # optional pre-release version number
+	\.?(?P[a-z0-9]+\+[a-z]+)? # optional nightly release indicator
 	)?
 serialize =
-	{major}.{minor}.{patch}{prekind}{pre}.{nightly}
-	{major}.{minor}.{patch}{prekind}{pre}
+	{major}.{minor}.{patch}{prekind}{num}.{nightly}
+	{major}.{minor}.{patch}{prekind}{num}
 	{major}.{minor}.{patch}
 commit = False
 tag = False
@@ -23,7 +29,7 @@ values =
 	rc
 	final
 
-[bumpversion:part:pre]
+[bumpversion:part:num]
 first_value = 1
 
 [bumpversion:part:nightly]