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: |