Show More
@@ -396,9 +396,38 def _try_get_version(): | |||
|
396 | 396 | "only(parents(),'%s')" % ltag, |
|
397 | 397 | ] |
|
398 | 398 | changessince = len(hg.run(changessincecmd).splitlines()) |
|
399 | version = '%s+hg%s.%s' % (ltag, changessince, hgid) | |
|
399 | branch = hg.run(["branch"]).strip() | |
|
400 | if branch == b'stable': | |
|
401 | post_nb = 0 | |
|
402 | elif branch == b'default': | |
|
403 | # we use 1 here to be greater than 0 to make sure change from | |
|
404 | # default are considered newer than change on stable | |
|
405 | post_nb = 1 | |
|
406 | else: | |
|
407 | # what is this branch ? probably a local variant ? | |
|
408 | post_nb = 2 | |
|
409 | ||
|
410 | # logic of the scheme | |
|
411 | # - '.postX' to mark the version as "above" the tagged version | |
|
412 | # X is 0 for stable, 1 for default, 2 for anything else | |
|
413 | # - use '.devY' | |
|
414 | # Y is the number of extra revision compared to the tag. So that | |
|
415 | # revision with more change are "above" previous ones. | |
|
416 | # - '+hg.NODEID.local.DATE' if there is any uncommitted changes. | |
|
417 | ltag = ltag.replace('6.9', '6.9.0') | |
|
418 | version = '%s.post%d.dev%d+hg.%s' % (ltag, post_nb, changessince, hgid) | |
|
400 | 419 | if version.endswith('+'): |
|
401 | version = version[:-1] + 'local' + time.strftime('%Y%m%d') | |
|
420 | version = version[:-1] + '.local.' + time.strftime('%Y%m%d') | |
|
421 | # try to give warning early about bad version if possible | |
|
422 | try: | |
|
423 | from packaging.version import Version | |
|
424 | ||
|
425 | Version(version) | |
|
426 | except ImportError: | |
|
427 | pass | |
|
428 | except ValueError as exc: | |
|
429 | eprint(r"/!\ generated version is invalid") | |
|
430 | eprint(r"/!\ error: %s" % exc) | |
|
402 | 431 | return version |
|
403 | 432 | |
|
404 | 433 |
General Comments 0
You need to be logged in to leave comments.
Login now