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')]) |