From 87707af101a9ad19562b3bd07f2e0ece52f527cf Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Tue, 21 Oct 2025 15:16:48 -0500 Subject: [PATCH] Build: Use date as revision when using a shallow clone --- src/Tools/SubWCRev.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Tools/SubWCRev.py b/src/Tools/SubWCRev.py index 6345820e95..f52db8297a 100644 --- a/src/Tools/SubWCRev.py +++ b/src/Tools/SubWCRev.py @@ -8,7 +8,7 @@ # 2012/02/01: The script was extended to support git # 2011/02/05: The script was extended to support also Bazaar -import os, sys, re, time, getopt +import os, sys, re, datetime, time, getopt from urllib.parse import urlparse import xml.sax import xml.sax.handler @@ -305,8 +305,10 @@ class GitControl(VersionControl): result = None countallfh = os.popen("git rev-list --count %s..HEAD" % referencecommit) countallstr = countallfh.read().strip() - if countallfh.close() is not None: # reference commit not present - self.rev = "%04d (Git shallow)" % referencerevision + if countallfh.close() is not None: # reference commit not present, use the date + date_object = datetime.datetime.strptime(self.date, "%Y/%m/%d %H:%M:%S") + formatted_date = date_object.strftime("%Y%m%d") + self.rev = f"{formatted_date} (Git shallow)" return else: countall = int(countallstr)