Fix specification of major/minor with latest.
authorCarl Hetherington <cth@carlh.net>
Sun, 25 Mar 2018 11:09:28 +0000 (12:09 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 25 Mar 2018 11:09:28 +0000 (12:09 +0100)
cdist

diff --git a/cdist b/cdist
index fece7574c1dc87896094d0c5f06d0adb6e459b72..1c7433699597e0e18117182a59b820116ed32d66 100755 (executable)
--- a/cdist
+++ b/cdist
@@ -833,7 +833,8 @@ def main():
     parser.add_argument('-p', '--project', help='project name')
     parser.add_argument('--minor', help='minor version number bump', action='store_true')
     parser.add_argument('--micro', help='micro version number bump', action='store_true')
-    parser.add_argument('--major', help='major version to return with latest', type=int)
+    parser.add_argument('--latest-major', help='major version to return with latest', type=int)
+    parser.add_argument('--latest-minor', help='minor version to return with latest', type=int)
     parser.add_argument('-c', '--checkout', help='string to pass to git for checkout')
     parser.add_argument('-o', '--output', help='output directory', default='.')
     parser.add_argument('-q', '--quiet', help='be quiet', action='store_true')
@@ -1038,7 +1039,7 @@ def main():
                             t = s[1]
                         if len(t) > 0 and t[0] == 'v':
                             v = Version(t[1:])
-                            if args.major is None or v.major == args.major:
+                            if (args.latest_major is None or v.major == args.latest_major) and (args.latest_minor is None or v.minor == args.latest_minor):
                                 latest = v
 
         print(latest)