Revert "git-cl: Remove unused and duplicate functions."
This reverts commit e3a49aa40576da2427447f7fedb670d5d59216e5.
Reason for revert:
TypeError: expected str, bytes or os.PathLike object, not NoneType
Original change's description:
> git-cl: Remove unused and duplicate functions.
>
> Remove unused functions, and use scm.GIT where possible to reduce
> duplication.
>
> Change-Id: I24f05e7b3ae04743e97b6665ee668f44d6acc294
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2116938
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
TBR=ehmaldonado@chromium.org,apolito@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com
Change-Id: I334a6289eb2c1f3e20feddd428307542d2aa38a9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2119411
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/gclient_scm.py b/gclient_scm.py
index 4079acb..d97c7e8 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -230,6 +230,18 @@
filter_kwargs['predicate'] = self.out_cb
self.filter = gclient_utils.GitFilter(**filter_kwargs)
+ @staticmethod
+ def BinaryExists():
+ """Returns true if the command exists."""
+ try:
+ # We assume git is newer than 1.7. See: crbug.com/114483
+ result, version = scm.GIT.AssertVersion('1.7')
+ if not result:
+ raise gclient_utils.Error('Git version is older than 1.7: %s' % version)
+ return result
+ except OSError:
+ return False
+
def GetCheckoutRoot(self):
return scm.GIT.GetCheckoutRoot(self.checkout_path)