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

Unified Diff: scm.py

Issue 184343003: Now trychange can store patches in a Git repo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: branch -> ref Created 6 years, 9 months 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
« no previous file with comments | « no previous file | tests/scm_unittest.py » ('j') | trychange.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scm.py
diff --git a/scm.py b/scm.py
index 30bb3d17ea49bd74c0a83af490bbc486d60e3f41..d53b4f4ed75f2cc29476003d7602549735b45626 100644
--- a/scm.py
+++ b/scm.py
@@ -141,6 +141,10 @@ class GIT(object):
return results
@staticmethod
+ def IsWorkTreeDirty(cwd):
+ return GIT.Capture(['status', '-s'], cwd=cwd) != ''
+
+ @staticmethod
def GetEmail(cwd):
"""Retrieves the user email address if known."""
# We could want to look at the svn cred when it has a svn remote but it
@@ -390,6 +394,17 @@ class GIT(object):
return os.path.abspath(os.path.join(cwd, root))
@staticmethod
+ def GetGitDir(cwd):
+ return os.path.abspath(GIT.Capture(['rev-parse', '--git-dir'], cwd=cwd))
+
+ @staticmethod
+ def IsInsideWorkTree(cwd):
+ try:
+ return GIT.Capture(['rev-parse', '--is-inside-work-tree'], cwd=cwd)
+ except (OSError, subprocess2.CalledProcessError):
+ return False
+
+ @staticmethod
def GetGitSvnHeadRev(cwd):
"""Gets the most recently pulled git-svn revision."""
try:
« no previous file with comments | « no previous file | tests/scm_unittest.py » ('j') | trychange.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698