Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: packager.py

Issue 29904555: Issue 7004 - Actually return git's result (Closed)
Patch Set: Created Oct. 8, 2018, 1:34 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packager.py
diff --git a/packager.py b/packager.py
index ab9557148de8834951ea1ea93e83c55a0be18cf9..d4f7b8fd35848077864fed893314cbe91862eec8 100644
--- a/packager.py
+++ b/packager.py
@@ -72,8 +72,11 @@ def getBuildNum(baseDir):
result = subprocess.check_output(['hg', 'id', '-R', baseDir, '-n'])
return re.sub(r'\D', '', result)
elif Git().istype(baseDir):
- result = subprocess.check_output(['git', 'rev-list', 'HEAD'], cwd=baseDir)
- return str(len(result.splitlines()))
+ result = subprocess.check_output(
+ ['git', 'rev-list', '--count', '--branches', '--tags'],
+ cwd=baseDir,
+ )
+ return result.strip()
Sebastian Noack 2018/10/08 14:01:04 Perhaps we can unify the code paths here: if Me
tlucas 2018/10/08 14:19:42 I see how this would improve the code, but since w
Sebastian Noack 2018/10/08 14:26:06 I think the requested change is trivial, and makes
except subprocess.CalledProcessError:
pass
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld