diff options
Diffstat (limited to 'utils/common/gitscraper.py')
-rwxr-xr-x | utils/common/gitscraper.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/utils/common/gitscraper.py b/utils/common/gitscraper.py index 5b3b316115..8d162155d9 100755 --- a/utils/common/gitscraper.py +++ b/utils/common/gitscraper.py | |||
@@ -142,6 +142,23 @@ def get_object(repo, blob, destfile): | |||
142 | return True | 142 | return True |
143 | 143 | ||
144 | 144 | ||
145 | def parse_rev(repo, hash): | ||
146 | '''Retrieve output of git rev-parse for a given hash. | ||
147 | @param repo Path to repository root. | ||
148 | @param hash Hash identifying the tree / commit to describe. | ||
149 | @return Description string. | ||
150 | ''' | ||
151 | output = subprocess.Popen( | ||
152 | ["git", "rev-parse", "--verify", "--short=10", hash], | ||
153 | stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=repo) | ||
154 | cmdout = output.communicate() | ||
155 | if len(cmdout[1]) > 0: | ||
156 | print("An error occured!\n") | ||
157 | print(cmdout[1]) | ||
158 | return "" | ||
159 | return cmdout[0].decode().rstrip() | ||
160 | |||
161 | |||
145 | def describe_treehash(repo, treehash): | 162 | def describe_treehash(repo, treehash): |
146 | '''Retrieve output of git-describe for a given hash. | 163 | '''Retrieve output of git-describe for a given hash. |
147 | @param repo Path to repository root. | 164 | @param repo Path to repository root. |