##// END OF EJS Templates
added revision into version for beta
marcink -
r807:e8c9ff1d beta
parent child Browse files
Show More
@@ -1,8 +1,16 b''
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # RhodeCode, a web based repository management based on pylons
4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
5 #
1 # -*- coding: utf-8 -*-
2 """
3 package.rhodecode.__init__
4 ~~~~~~~~~~~~~~
5
6 RhodeCode, a web based repository management based on pylons
7 versioning implementation: http://semver.org/
8
9 :created_on: Apr 9, 2010
10 :author: marcink
11 :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
12 :license: GPLv3, see COPYING for more details.
13 """
6 14 # This program is free software; you can redistribute it and/or
7 15 # modify it under the terms of the GNU General Public License
8 16 # as published by the Free Software Foundation; version 2
@@ -17,16 +25,16 b''
17 25 # along with this program; if not, write to the Free Software
18 26 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 27 # MA 02110-1301, USA.
20 """
21 Created on April 9, 2010
22 RhodeCode, a web based repository management based on pylons
23 versioning implementation: http://semver.org/
24 @author: marcink
25 """
28
26 29
27 30 VERSION = (1, 1, 0, 'beta')
31 __version__ = '.'.join((str(each) for each in VERSION[:4]))
28 32
29 __version__ = '.'.join((str(each) for each in VERSION[:4]))
33
34 from rhodecode.lib.utils import get_current_revision
35 _rev = get_current_revision()
36 if 'beta' in VERSION and _rev:
37 __version__ += ' [rev:%s]' % _rev[0]
30 38
31 39 def get_version():
32 40 """
@@ -29,7 +29,6 b' import os'
29 29 import logging
30 30 import datetime
31 31 import traceback
32 import ConfigParser
33 32
34 33 from UserDict import DictMixin
35 34
@@ -443,6 +442,24 b' def add_cache(settings):'
443 442 'memory')
444 443 beaker.cache.cache_regions[region] = region_settings
445 444
445 def get_current_revision():
446 """
447 Returns tuple of (number, id) from repository containing this package
448 or None if repository could not be found.
449 """
450 try:
451 from vcs import get_repo
452 from vcs.utils.helpers import get_scm
453 from vcs.exceptions import RepositoryError, VCSError
454 repopath = os.path.join(os.path.dirname(__file__), '..', '..')
455 scm = get_scm(repopath)[0]
456 repo = get_repo(path=repopath, alias=scm)
457 tip = repo.get_changeset()
458 return (tip.revision, tip.short_id)
459 except (ImportError, RepositoryError, VCSError), err:
460 logging.debug("Cannot retrieve rhodecode's revision. Original error "
461 "was: %s" % err)
462 return None
446 463
447 464 #===============================================================================
448 465 # TEST FUNCTIONS AND CREATORS
General Comments 0
You need to be logged in to leave comments. Login now