Index: gclient_utils.py |
diff --git a/gclient_utils.py b/gclient_utils.py |
index 9c62a2a5b53af41b5aedae595bda06ecc61b1b77..f0d8cec6f49cb99637af1c11ac8e5e54d5ef8bb1 100644 |
--- a/gclient_utils.py |
+++ b/gclient_utils.py |
@@ -84,6 +84,11 @@ def SplitUrlRevision(url): |
return tuple(components) |
+def IsGitSha(revision): |
+ """Returns true if the given string is a valid hex-encoded sha""" |
+ return re.match('^[a-fA-F0-9]{6,40}$', revision) is not None |
+ |
+ |
def IsDateRevision(revision): |
"""Returns true if the given revision is of the form "{ ... }".""" |
return bool(revision and re.match(r'^\{.+\}$', str(revision))) |