Show More
@@ -1,24 +1,25 b'' | |||||
1 | import os |
|
1 | import os | |
2 |
|
2 | |||
3 |
|
3 | |||
4 | def get_current_revision(quiet=False): |
|
4 | def get_current_revision(quiet=False): | |
5 | """ |
|
5 | """ | |
6 | Returns tuple of (number, id) from repository containing this package |
|
6 | Returns tuple of (number, id) from repository containing this package | |
7 | or None if repository could not be found. |
|
7 | or None if repository could not be found. | |
8 |
|
8 | |||
9 | :param quiet: prints error for fetching revision if True |
|
9 | :param quiet: prints error for fetching revision if True | |
10 | """ |
|
10 | """ | |
11 |
|
11 | |||
12 | try: |
|
12 | try: | |
13 | from rhodecode.lib.vcs import get_repo |
|
13 | from rhodecode.lib.vcs import get_repo | |
14 | from rhodecode.lib.vcs.utils.helpers import get_scm |
|
14 | from rhodecode.lib.vcs.utils.helpers import get_scm | |
15 | repopath = os.path.join(os.path.dirname(__file__), '..', '..') |
|
15 | repopath = os.path.join(os.path.dirname(__file__), '..', '..') | |
16 | scm = get_scm(repopath)[0] |
|
16 | scm = get_scm(repopath)[0] | |
17 | repo = get_repo(path=repopath, alias=scm) |
|
17 | repo = get_repo(path=repopath, alias=scm) | |
18 | tip = repo.get_changeset() |
|
18 | tip = repo.get_changeset() | |
19 | return (tip.revision, tip.short_id) |
|
19 | return (tip.revision, tip.short_id) | |
20 | except Exception, err: |
|
20 | except Exception, err: | |
21 | if not quiet: |
|
21 | if not quiet: | |
22 |
print ("Cannot retrieve rhodecode's revision. |
|
22 | print ("WARNING: Cannot retrieve rhodecode's revision. " | |
23 | "was: %s" % err) |
|
23 | "disregard this if you don't know what that means. " | |
|
24 | "Original error was: %s" % err) | |||
24 | return None |
|
25 | return None |
General Comments 0
You need to be logged in to leave comments.
Login now