comparison setup.py @ 23647:eb55e09202c8

setup: use changes since latest tag instead of just distance For a Mercurial built on the merge from stable into default right after 3.2.2 was released -- 19ebd2f88fc7 -- the version number produced was "3.2.2+4". This is potentially misleading, since in reality the built Mercurial includes many more changes compared to 3.2.2. Change the versioning scheme so that we take into consideration all the changes present in the current revision that aren't present in the latest tag. For 19ebd2f88fc7 the new versioning scheme results in a version number of "3.2.2+256". This gives users a much better idea of how many changes have actually happened since the latest release. Since changessincelatesttag is always greater than or equal to the latesttagdistance, this will produce version numbers that are always greater than or equal to the old scheme. Thus there's minimal compatibility risk.
author Siddharth Agarwal <sid0@fb.com>
date Fri, 12 Dec 2014 15:31:28 -0800
parents 9641643fac71
children 6bc1702e7333
comparison
equal deleted inserted replaced
23646:9641643fac71 23647:eb55e09202c8
194 if numerictags: # tag(s) found 194 if numerictags: # tag(s) found
195 version = numerictags[-1] 195 version = numerictags[-1]
196 if hgid.endswith('+'): # propagate the dirty status to the tag 196 if hgid.endswith('+'): # propagate the dirty status to the tag
197 version += '+' 197 version += '+'
198 else: # no tag found 198 else: # no tag found
199 cmd = [sys.executable, 'hg', 'parents', '--template', 199 ltagcmd = [sys.executable, 'hg', 'parents', '--template',
200 '{latesttag}+{latesttagdistance}-'] 200 '{latesttag}']
201 version = runhg(cmd, env) + hgid 201 ltag = runhg(ltagcmd, env)
202 changessincecmd = [sys.executable, 'hg', 'log', '-T', 'x\n', '-r',
203 "only(.,'%s')" % ltag]
204 changessince = len(runhg(changessincecmd, env).splitlines())
205 version = '%s+%s-%s' % (ltag, changessince, hgid)
202 if version.endswith('+'): 206 if version.endswith('+'):
203 version += time.strftime('%Y%m%d') 207 version += time.strftime('%Y%m%d')
204 elif os.path.exists('.hg_archival.txt'): 208 elif os.path.exists('.hg_archival.txt'):
205 kw = dict([[t.strip() for t in l.split(':', 1)] 209 kw = dict([[t.strip() for t in l.split(':', 1)]
206 for l in open('.hg_archival.txt')]) 210 for l in open('.hg_archival.txt')])