Show More
@@ -15,8 +15,9 b' def get_current_revision(quiet=False):' | |||||
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 | wk_dir = repo.workdir | |
19 | return (tip.revision, tip.short_id) |
|
19 | cur_rev = wk_dir.get_changeset() | |
|
20 | return (cur_rev.revision, cur_rev.short_id) | |||
20 | except Exception, err: |
|
21 | except Exception, err: | |
21 | if not quiet: |
|
22 | if not quiet: | |
22 | print ("WARNING: Cannot retrieve rhodecode's revision. " |
|
23 | print ("WARNING: Cannot retrieve rhodecode's revision. " |
@@ -20,8 +20,8 b' class GitWorkdir(BaseWorkdir):' | |||||
20 | raise RepositoryError("Couldn't compute workdir's branch") |
|
20 | raise RepositoryError("Couldn't compute workdir's branch") | |
21 |
|
21 | |||
22 | def get_changeset(self): |
|
22 | def get_changeset(self): | |
23 | return self.repository.get_changeset( |
|
23 | wk_dir_id = self.repository._repo.refs.as_dict().get('HEAD') | |
24 | self.repository._repo.refs.as_dict().get('HEAD')) |
|
24 | return self.repository.get_changeset(wk_dir_id) | |
25 |
|
25 | |||
26 | def checkout_branch(self, branch=None): |
|
26 | def checkout_branch(self, branch=None): | |
27 | if branch is None: |
|
27 | if branch is None: |
@@ -10,7 +10,8 b' class MercurialWorkdir(BaseWorkdir):' | |||||
10 | return self.repository._repo.dirstate.branch() |
|
10 | return self.repository._repo.dirstate.branch() | |
11 |
|
11 | |||
12 | def get_changeset(self): |
|
12 | def get_changeset(self): | |
13 | return self.repository.get_changeset() |
|
13 | wk_dir_id = self.repository._repo[None].parents()[0].hex() | |
|
14 | return self.repository.get_changeset(wk_dir_id) | |||
14 |
|
15 | |||
15 | def checkout_branch(self, branch=None): |
|
16 | def checkout_branch(self, branch=None): | |
16 | if branch is None: |
|
17 | if branch is None: |
General Comments 0
You need to be logged in to leave comments.
Login now