Mercurial > hg-stable
changeset 52206:2b7e3177f99c stable
setup: use the same code to compute tag from archive
Let us make sure we use a consistent version across the board.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 13 Nov 2024 14:34:40 +0100 |
parents | 35a9b6d3b484 |
children | 05addf266f6f |
files | setup.py |
diffstat | 1 files changed, 15 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/setup.py Wed Nov 13 14:28:25 2024 +0100 +++ b/setup.py Wed Nov 13 14:34:40 2024 +0100 @@ -457,16 +457,23 @@ [[t.strip() for t in l.split(':', 1)] for l in open('.hg_archival.txt')] ) if 'tag' in kw: - version = kw['tag'] + version = _version(tag=kw['tag']) elif 'latesttag' in kw: - if 'changessincelatesttag' in kw: - version = ( - '%(latesttag)s+hg%(changessincelatesttag)s.%(node).12s' % kw - ) - else: - version = '%(latesttag)s+hg%(latesttagdistance)s.%(node).12s' % kw + distance = int(kw.get('changessincelatesttag', kw['latesttagdistance'])) + version = _version( + tag=kw['latesttag'], + branch=kw['branch'], + changes_since=distance, + hgid=kw['node'][:12], + ) else: - version = '0+hg' + kw.get('node', '')[:12] + version = _version( + tag='0', + branch='unknown-source', + changes_since=1, + hgid=kw.get('node', 'unknownid')[:12], + dirty=True, + ) elif os.path.exists('mercurial/__version__.py'): with open('mercurial/__version__.py') as f: data = f.read()