Show More
@@ -35,7 +35,7 b" PLATFORM_WIN = ('Windows')" | |||||
35 | PLATFORM_OTHERS = ('Linux', 'Darwin', 'FreeBSD', 'OpenBSD', 'SunOS') |
|
35 | PLATFORM_OTHERS = ('Linux', 'Darwin', 'FreeBSD', 'OpenBSD', 'SunOS') | |
36 |
|
36 | |||
37 | try: |
|
37 | try: | |
38 |
from rhodecode.lib |
|
38 | from rhodecode.lib import get_current_revision | |
39 | _rev = get_current_revision() |
|
39 | _rev = get_current_revision() | |
40 | except ImportError: |
|
40 | except ImportError: | |
41 | #this is needed when doing some setup.py operations |
|
41 | #this is needed when doing some setup.py operations |
@@ -23,6 +23,8 b'' | |||||
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
24 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
25 |
|
25 | |||
|
26 | import os | |||
|
27 | ||||
26 | def __get_lem(): |
|
28 | def __get_lem(): | |
27 | from pygments import lexers |
|
29 | from pygments import lexers | |
28 | from string import lower |
|
30 | from string import lower | |
@@ -379,3 +381,24 b' def get_changeset_safe(repo, rev):' | |||||
379 | from rhodecode.lib.utils import EmptyChangeset |
|
381 | from rhodecode.lib.utils import EmptyChangeset | |
380 | cs = EmptyChangeset(requested_revision=rev) |
|
382 | cs = EmptyChangeset(requested_revision=rev) | |
381 | return cs |
|
383 | return cs | |
|
384 | ||||
|
385 | ||||
|
386 | def get_current_revision(): | |||
|
387 | """ | |||
|
388 | Returns tuple of (number, id) from repository containing this package | |||
|
389 | or None if repository could not be found. | |||
|
390 | """ | |||
|
391 | ||||
|
392 | try: | |||
|
393 | from vcs import get_repo | |||
|
394 | from vcs.utils.helpers import get_scm | |||
|
395 | from vcs.exceptions import RepositoryError, VCSError | |||
|
396 | repopath = os.path.join(os.path.dirname(__file__), '..', '..') | |||
|
397 | scm = get_scm(repopath)[0] | |||
|
398 | repo = get_repo(path=repopath, alias=scm) | |||
|
399 | tip = repo.get_changeset() | |||
|
400 | return (tip.revision, tip.short_id) | |||
|
401 | except (ImportError, RepositoryError, VCSError), err: | |||
|
402 | print ("Cannot retrieve rhodecode's revision. Original error " | |||
|
403 | "was: %s" % err) | |||
|
404 | return None |
@@ -445,26 +445,6 b' def add_cache(settings):' | |||||
445 | beaker.cache.cache_regions[region] = region_settings |
|
445 | beaker.cache.cache_regions[region] = region_settings | |
446 |
|
446 | |||
447 |
|
447 | |||
448 | def get_current_revision(): |
|
|||
449 | """Returns tuple of (number, id) from repository containing this package |
|
|||
450 | or None if repository could not be found. |
|
|||
451 | """ |
|
|||
452 |
|
||||
453 | try: |
|
|||
454 | from vcs import get_repo |
|
|||
455 | from vcs.utils.helpers import get_scm |
|
|||
456 | from vcs.exceptions import RepositoryError, VCSError |
|
|||
457 | repopath = os.path.join(os.path.dirname(__file__), '..', '..') |
|
|||
458 | scm = get_scm(repopath)[0] |
|
|||
459 | repo = get_repo(path=repopath, alias=scm) |
|
|||
460 | tip = repo.get_changeset() |
|
|||
461 | return (tip.revision, tip.short_id) |
|
|||
462 | except (ImportError, RepositoryError, VCSError), err: |
|
|||
463 | logging.debug("Cannot retrieve rhodecode's revision. Original error " |
|
|||
464 | "was: %s" % err) |
|
|||
465 | return None |
|
|||
466 |
|
||||
467 |
|
||||
468 | #============================================================================== |
|
448 | #============================================================================== | |
469 | # TEST FUNCTIONS AND CREATORS |
|
449 | # TEST FUNCTIONS AND CREATORS | |
470 | #============================================================================== |
|
450 | #============================================================================== |
General Comments 0
You need to be logged in to leave comments.
Login now