Mercurial > kallithea
comparison rhodecode/lib/utils.py @ 807:e8c9ff1da9ba beta
added revision into version for beta
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 05 Dec 2010 00:52:11 +0100 |
parents | 277427ac29a9 |
children | 9753e0907827 |
comparison
equal
deleted
inserted
replaced
806:499fa8e87c90 | 807:e8c9ff1da9ba |
---|---|
27 | 27 |
28 import os | 28 import os |
29 import logging | 29 import logging |
30 import datetime | 30 import datetime |
31 import traceback | 31 import traceback |
32 import ConfigParser | |
33 | 32 |
34 from UserDict import DictMixin | 33 from UserDict import DictMixin |
35 | 34 |
36 from mercurial import ui, config, hg | 35 from mercurial import ui, config, hg |
37 from mercurial.error import RepoError | 36 from mercurial.error import RepoError |
441 if 'type' not in region_settings: | 440 if 'type' not in region_settings: |
442 region_settings['type'] = cache_settings.get('type', | 441 region_settings['type'] = cache_settings.get('type', |
443 'memory') | 442 'memory') |
444 beaker.cache.cache_regions[region] = region_settings | 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 # TEST FUNCTIONS AND CREATORS | 465 # TEST FUNCTIONS AND CREATORS |
449 #=============================================================================== | 466 #=============================================================================== |
450 def create_test_index(repo_location, full_index): | 467 def create_test_index(repo_location, full_index): |