##// END OF EJS Templates
setup: calculate version more correctly...
Bryan O'Sullivan -
r17709:b7fff47b default
parent child Browse files
Show More
@@ -172,18 +172,17 b" if 'SystemRoot' in os.environ:"
172 env['SystemRoot'] = os.environ['SystemRoot']
172 env['SystemRoot'] = os.environ['SystemRoot']
173
173
174 if os.path.isdir('.hg'):
174 if os.path.isdir('.hg'):
175 cmd = [sys.executable, 'hg', 'id', '-i', '-t']
175 cmd = [sys.executable, 'hg', 'log', '-r', '.', '--template', '{tags}\n']
176 l = runhg(cmd, env).split()
176 numerictags = [t for t in runhg(cmd, env).split() if t[0].isdigit()]
177 while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags
177 hgid = runhg([sys.executable, 'hg', 'id', '-i'], env).strip()
178 l.pop()
178 if numerictags: # tag(s) found
179 if len(l) > 1: # tag found
179 version = numerictags[-1]
180 version = l[-1]
180 if hgid.endswith('+'): # propagate the dirty status to the tag
181 if l[0].endswith('+'): # propagate the dirty status to the tag
182 version += '+'
181 version += '+'
183 elif len(l) == 1: # no tag found
182 else: # no tag found
184 cmd = [sys.executable, 'hg', 'parents', '--template',
183 cmd = [sys.executable, 'hg', 'parents', '--template',
185 '{latesttag}+{latesttagdistance}-']
184 '{latesttag}+{latesttagdistance}-']
186 version = runhg(cmd, env) + l[0]
185 version = runhg(cmd, env) + hgid
187 if version.endswith('+'):
186 if version.endswith('+'):
188 version += time.strftime('%Y%m%d')
187 version += time.strftime('%Y%m%d')
189 elif os.path.exists('.hg_archival.txt'):
188 elif os.path.exists('.hg_archival.txt'):
General Comments 0
You need to be logged in to leave comments. Login now