changeset 50168:593f5e4076ff stable

setup: support building from an ongoing merge Before this change the two parents from the merge would duplicate some command output and modify some others in a way python 3.11 chokes on.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 22 Feb 2023 18:30:47 +0100
parents 812a9fbf4380
children 34ab5c7b7f98
files setup.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Thu Feb 16 11:42:34 2023 +0100
+++ b/setup.py	Wed Feb 22 18:30:47 2023 +0100
@@ -337,6 +337,8 @@
     pieces = sysstr(hg.run(cmd)).split()
     numerictags = [t for t in pieces if t[0:1].isdigit()]
     hgid = sysstr(hg.run(['id', '-i'])).strip()
+    if hgid.count('+') == 2:
+        hgid = hgid.replace("+", ".", 1)
     if not hgid:
         eprint("/!\\")
         eprint(r"/!\ Unable to determine hg version from local repository")
@@ -347,7 +349,7 @@
         if hgid.endswith('+'):  # propagate the dirty status to the tag
             version += '+'
     else:  # no tag found on the checked out revision
-        ltagcmd = ['parents', '--template', '{latesttag}']
+        ltagcmd = ['log', '--rev', 'wdir()', '--template', '{latesttag}']
         ltag = sysstr(hg.run(ltagcmd))
         if not ltag:
             eprint("/!\\")
@@ -356,7 +358,13 @@
                 r"/!\ Failed to retrieve current revision distance to lated tag"
             )
             return ''
-        changessincecmd = ['log', '-T', 'x\n', '-r', "only(.,'%s')" % ltag]
+        changessincecmd = [
+            'log',
+            '-T',
+            'x\n',
+            '-r',
+            "only(parents(),'%s')" % ltag,
+        ]
         changessince = len(hg.run(changessincecmd).splitlines())
         version = '%s+hg%s.%s' % (ltag, changessince, hgid)
     if version.endswith('+'):