Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

version: introduce version.package_version()

Numbering scheme for Windows packages: major.minor.micro
Where micro is either a small number 0..3 for timed releases, or
N1xxx for stable nightly builds (N is the timed release number) or
N5xxx for unstable nightly builds (N is the timed release number).

For instance:
the package version for tagged release 0.9.4 would be 0.9.4
the package version for stable nightly 0.9.4+8-#hash# would be 0.9.41008
the package version for unstable nightly 0.9.4+42-#hash# would be 0.9.45042

Changeset f0bb84bac2f3

Parent 1c79d85d9d4c

by Steve Borho

Changes to 2 files · Browse files at f0bb84bac2f3 Showing diff from parent 1c79d85d9d4c Diff from another changeset...

Change 1 of 2 Show Entire File setup.py Stacked
 
183
184
185
186
 
187
188
189
 
213
214
215
216
 
 
217
218
219
 
183
184
185
 
186
187
188
189
 
213
214
215
 
216
217
218
219
220
@@ -183,7 +183,7 @@
   if os.path.isdir('.hg'):   from tortoisehg.util import version as _version - version = _version.liveversion() + branch, version = _version.liveversion()   if version.endswith('+'):   version += time.strftime('%Y%m%d')  elif os.path.exists('.hg_archival.txt'): @@ -213,7 +213,8 @@
  desc = 'Windows shell extension for Mercurial VCS'   # Windows binary file versions for exe/dll files must have the   # form W.X.Y.Z, where W,X,Y,Z are numbers in the range 0..65535 - setupversion = version.split('+', 1)[0] + from tortoisehg.util.version import package_version + setupversion = package_version()   productname = 'TortoiseHg'  else:   (scripts, packages, data_files, extra) = setup_posix()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
36
37
38
39
 
 
40
41
42
43
44
45
46
47
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 
35
36
37
38
 
39
40
41
42
43
44
45
46
47
48
 
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 # version.py - TortoiseHg version  #  # Copyright 2009 Steve Borho <steve@borho.org>  #  # This software may be used and distributed according to the terms of the  # GNU General Public License version 2, incorporated herein by reference.    import os  from mercurial import ui, hg, commands, error  from tortoisehg.util.i18n import _    def liveversion():   'Attempt to read the version from the live repository'   utilpath = os.path.dirname(os.path.realpath(__file__))   thgpath = os.path.dirname(os.path.dirname(utilpath))   if not os.path.isdir(os.path.join(thgpath, '.hg')):   raise error.RepoError(_('repository %s not found') % thgpath)     u = ui.ui()   repo = hg.repository(u, path=thgpath)     u.pushbuffer()   commands.identify(u, repo, id=True, tags=True)   l = u.popbuffer().split()   while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags   l.pop()   if len(l) > 1: # tag found   version = l[-1]   if l[0].endswith('+'): # propagate the dirty status to the tag   version += '+'   elif len(l) == 1: # no tag found   u.pushbuffer()   commands.parents(u, repo, template='{latesttag}+{latesttagdistance}-')   version = u.popbuffer() + l[0] - return version + return repo[None].branch(), version    def version():   try: - return liveversion() + branch, version = liveversion() + return version   except:   pass   try:   import __version__   return __version__.version   except ImportError:   return _('unknown')   - +def package_version(): + try: + branch, version = liveversion() + if '+' in version: + version, extra = version.split('+', 1) + major, minor, periodic = version.split('.') + tagdistance = int(extra.split('-', 1)[0]) + periodic = int(periodic) * 10000 + if branch == 'default': + periodic += tagdistance + 5000 + else: + periodic += tagdistance + 1000 + version = '.'.join([major, minor, str(periodic)]) + return version + except: + pass + return _('unknown')