# HG changeset patch # User Marcin Kuzminski # Date 1318292082 -7200 # Node ID 70e646b2806aba4549b983821ac95e5745f2beb8 # Parent 191f3f08236d16c4fe49453eb4dc6c4093b979ff fixes rhodecode upgrade problem that caused setuptool to crash on importing sqlalchemy models diff -r 191f3f08236d -r 70e646b2806a rhodecode/__init__.py --- a/rhodecode/__init__.py Tue Oct 11 01:08:23 2011 +0200 +++ b/rhodecode/__init__.py Tue Oct 11 02:14:42 2011 +0200 @@ -35,7 +35,7 @@ PLATFORM_OTHERS = ('Linux', 'Darwin', 'FreeBSD', 'OpenBSD', 'SunOS') try: - from rhodecode.lib.utils import get_current_revision + from rhodecode.lib import get_current_revision _rev = get_current_revision() except ImportError: #this is needed when doing some setup.py operations diff -r 191f3f08236d -r 70e646b2806a rhodecode/lib/__init__.py --- a/rhodecode/lib/__init__.py Tue Oct 11 01:08:23 2011 +0200 +++ b/rhodecode/lib/__init__.py Tue Oct 11 02:14:42 2011 +0200 @@ -23,6 +23,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import os + def __get_lem(): from pygments import lexers from string import lower @@ -379,3 +381,24 @@ from rhodecode.lib.utils import EmptyChangeset cs = EmptyChangeset(requested_revision=rev) return cs + + +def get_current_revision(): + """ + Returns tuple of (number, id) from repository containing this package + or None if repository could not be found. + """ + + try: + from vcs import get_repo + from vcs.utils.helpers import get_scm + from vcs.exceptions import RepositoryError, VCSError + repopath = os.path.join(os.path.dirname(__file__), '..', '..') + scm = get_scm(repopath)[0] + repo = get_repo(path=repopath, alias=scm) + tip = repo.get_changeset() + return (tip.revision, tip.short_id) + except (ImportError, RepositoryError, VCSError), err: + print ("Cannot retrieve rhodecode's revision. Original error " + "was: %s" % err) + return None diff -r 191f3f08236d -r 70e646b2806a rhodecode/lib/utils.py --- a/rhodecode/lib/utils.py Tue Oct 11 01:08:23 2011 +0200 +++ b/rhodecode/lib/utils.py Tue Oct 11 02:14:42 2011 +0200 @@ -445,26 +445,6 @@ beaker.cache.cache_regions[region] = region_settings -def get_current_revision(): - """Returns tuple of (number, id) from repository containing this package - or None if repository could not be found. - """ - - try: - from vcs import get_repo - from vcs.utils.helpers import get_scm - from vcs.exceptions import RepositoryError, VCSError - repopath = os.path.join(os.path.dirname(__file__), '..', '..') - scm = get_scm(repopath)[0] - repo = get_repo(path=repopath, alias=scm) - tip = repo.get_changeset() - return (tip.revision, tip.short_id) - except (ImportError, RepositoryError, VCSError), err: - logging.debug("Cannot retrieve rhodecode's revision. Original error " - "was: %s" % err) - return None - - #============================================================================== # TEST FUNCTIONS AND CREATORS #==============================================================================