Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1214)

Unified Diff: appengine/findit/lib/gitiles/repo_util.py

Issue 2432113002: [Findit] Add local_git_repository (Closed)
Patch Set: Rebase. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/findit/lib/gitiles/repo_util.py
diff --git a/appengine/findit/lib/gitiles/repo_util.py b/appengine/findit/lib/gitiles/repo_util.py
index 790a6f796a45259a9e985d14aa3c860c5ca3c1e0..9bc811fe38069ca849419c2428d58890ff5848e4 100644
--- a/appengine/findit/lib/gitiles/repo_util.py
+++ b/appengine/findit/lib/gitiles/repo_util.py
@@ -2,7 +2,11 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import json
+import logging
import re
+import subprocess
+import urllib2
CODE_REVIEW_URL_PATTERN = re.compile(
'^(?:Review URL|Review-Url): (.*\d+).*$', re.IGNORECASE)
@@ -69,3 +73,24 @@ def GetRevertedRevision(message):
reverted_revision_match = REVERTED_REVISION_PATTERN.match(line)
if reverted_revision_match:
return reverted_revision_match.group(1)
+
+
+# TODO(katesonia): Add local cache for this function.
+def GetCommandOutput(command):
+ """Gets the output stream of executable command.
+
+ Args:
+ command (str): Command to execute to get output.
+
+ Return:
+ Output steam of the command.
+ """
+ p = subprocess.Popen(
+ command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ stdoutdata, stderrdata = p.communicate()
+
+ if p.returncode != 0:
+ logging.error('Error running command %s: %s', command, stderrdata)
+ return None
wrengr 2016/11/01 20:26:53 You probably want to throw an exception packaging
Sharu Jiang 2016/11/05 01:18:15 Crashing the program working for local testing, bu
+
+ return stdoutdata

Powered by Google App Engine
This is Rietveld 408576698