Mercurial > hg
comparison setup.py @ 49972:1bd33932713d
branching: merge with stable
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 31 Jan 2023 11:41:59 +0100 |
parents | ff4df0954742 ac93876ea2df |
children | 0f0880c8a7e5 |
comparison
equal
deleted
inserted
replaced
49967:5698c5eee12b | 49972:1bd33932713d |
---|---|
215 | 215 |
216 def run(self, args): | 216 def run(self, args): |
217 cmd = self.cmd + args | 217 cmd = self.cmd + args |
218 returncode, out, err = runcmd(cmd, self.env) | 218 returncode, out, err = runcmd(cmd, self.env) |
219 err = filterhgerr(err) | 219 err = filterhgerr(err) |
220 if err or returncode != 0: | 220 if err: |
221 print("stderr from '%s':" % (' '.join(cmd)), file=sys.stderr) | 221 print("stderr from '%s':" % (' '.join(cmd)), file=sys.stderr) |
222 print(err, file=sys.stderr) | 222 print(err, file=sys.stderr) |
223 if returncode != 0: | |
223 return b'' | 224 return b'' |
224 return out | 225 return out |
225 | 226 |
226 | 227 |
227 def filterhgerr(err): | 228 def filterhgerr(err): |
331 if hgid.endswith('+'): # propagate the dirty status to the tag | 332 if hgid.endswith('+'): # propagate the dirty status to the tag |
332 version += '+' | 333 version += '+' |
333 else: # no tag found | 334 else: # no tag found |
334 ltagcmd = ['parents', '--template', '{latesttag}'] | 335 ltagcmd = ['parents', '--template', '{latesttag}'] |
335 ltag = sysstr(hg.run(ltagcmd)) | 336 ltag = sysstr(hg.run(ltagcmd)) |
337 if not ltag: | |
338 ltag = 'null' | |
336 changessincecmd = ['log', '-T', 'x\n', '-r', "only(.,'%s')" % ltag] | 339 changessincecmd = ['log', '-T', 'x\n', '-r', "only(.,'%s')" % ltag] |
337 changessince = len(hg.run(changessincecmd).splitlines()) | 340 changessince = len(hg.run(changessincecmd).splitlines()) |
341 if ltag == 'null': | |
342 ltag = '0.0' | |
338 version = '%s+hg%s.%s' % (ltag, changessince, hgid) | 343 version = '%s+hg%s.%s' % (ltag, changessince, hgid) |
339 if version.endswith('+'): | 344 if version.endswith('+'): |
340 version = version[:-1] + 'local' + time.strftime('%Y%m%d') | 345 version = version[:-1] + 'local' + time.strftime('%Y%m%d') |
341 elif os.path.exists('.hg_archival.txt'): | 346 elif os.path.exists('.hg_archival.txt'): |
342 kw = dict( | 347 kw = dict( |