allura
Revision | 7f890d6d722682c9b7718e4984f88440f6d80fbc (tree) |
---|---|
Time | 2012-07-11 07:22:10 |
Author | Tim Van Steenburgh <tvansteenburgh@gmai...> |
Commiter | Cory Johns |
[#4521] Lookup sha1 for ref from cache instead of disk.
Signed-off-by: Tim Van Steenburgh <tvansteenburgh@gmail.com>
@@ -105,6 +105,10 @@ class GitImplementation(M.RepositoryImplementation): | ||
105 | 105 | |
106 | 106 | def commit(self, rev): |
107 | 107 | '''Return a Commit object. rev can be _id or a branch/tag name''' |
108 | + for ref in self._repo.heads + self._repo.branches + self._repo.repo_tags: | |
109 | + if ref.name == rev: | |
110 | + rev = ref.object_id | |
111 | + break | |
108 | 112 | result = M.repo.Commit.query.get(_id=rev) |
109 | 113 | if result is None: |
110 | 114 | # find the id by branch/tag name |
@@ -92,6 +92,10 @@ class HgImplementation(M.RepositoryImplementation): | ||
92 | 92 | session(self._repo).flush() |
93 | 93 | |
94 | 94 | def commit(self, rev): |
95 | + for ref in self._repo.heads + self._repo.branches + self._repo.repo_tags: | |
96 | + if ref.name == rev: | |
97 | + rev = ref.object_id | |
98 | + break | |
95 | 99 | result = M.repo.Commit.query.get(_id=rev) |
96 | 100 | if result is None: |
97 | 101 | try: |