diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-10-06 00:28:46 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-10-06 00:28:46 +0100 |
| commit | b36c21b27ad999af018497caf776f21951157b90 (patch) | |
| tree | 7016edaea45350ddba3e8b30e821ed5aa85c364b | |
| parent | 8a15fb559482439412f854f97fd986a75380d710 (diff) | |
| parent | 7aee6a2be4a0d0dd46ff8ccf27212446adf7ae23 (diff) | |
Merge branch 'working-dir-changes'
| -rwxr-xr-x | cdist | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -560,6 +560,7 @@ parser.add_argument('-p', '--project', help='project name') parser.add_argument('-d', '--directory', help='directory within project repo', default='.') 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('-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') @@ -726,17 +727,20 @@ elif args.command == 'latest': project.checkout(target) f = command_and_read('git log --tags --simplify-by-decoration --pretty="%d"') - t = f.readline() - m = re.compile(".*\((.*)\).*").match(t) latest = None - if m: - tags = m.group(1).split(', ') - for t in tags: - s = t.split() - if len(s) > 1: - t = s[1] - if len(t) > 0 and t[0] == 'v': - latest = t[1:] + while latest is None: + t = f.readline() + m = re.compile(".*\((.*)\).*").match(t) + if m: + tags = m.group(1).split(', ') + for t in tags: + s = t.split() + if len(s) > 1: + 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: + latest = v print latest target.cleanup() |
