Move git-related functionality out of cros_build_lib (1 of 4).

cros_build_lib is starting to get really long -- it's now 2279 lines. This CL
moves git-related functionality out of cros_build_lib into git.py, reducing the
size and complexity of cros_build_lib by over 980 lines.

Note  CL:*29160 and CL:*29161 should also be committed at the same time as this
CL, but CQ is not capable of handling external -> internal dependencies, so we
leave this dependency as implicit.

BUG=none
CQ-DEPEND=CL:38255
TEST=pylint, regexps, run_tests, and lots of trybot runs.
Change-Id: Id6c749df09862a724bef2eee84ca719ed461589c
Reviewed-on: https://gerrit.chromium.org/gerrit/38253
Commit-Ready: David James <davidjames@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
diff --git a/scripts/upload_prebuilts.py b/scripts/upload_prebuilts.py
index e13333c..224373c 100644
--- a/scripts/upload_prebuilts.py
+++ b/scripts/upload_prebuilts.py
@@ -29,6 +29,7 @@
 from chromite.buildbot import constants
 from chromite.buildbot import portage_utilities
 from chromite.lib import cros_build_lib
+from chromite.lib import git
 from chromite.lib import gs
 from chromite.lib import osutils
 from chromite.lib import binpkg
@@ -139,18 +140,16 @@
   """
   prebuilt_branch = 'prebuilt_branch'
   cwd = os.path.abspath(os.path.dirname(filename))
-  commit = cros_build_lib.RunGitCommand(
-      cwd, ['rev-parse', 'HEAD']).output.rstrip()
+  commit = git.RunGit(cwd, ['rev-parse', 'HEAD']).output.rstrip()
   description = 'Update %s="%s" in %s' % (key, value, filename)
   print description
 
   try:
-    cros_build_lib.CreatePushBranch(prebuilt_branch, cwd)
+    git.CreatePushBranch(prebuilt_branch, cwd)
     UpdateLocalFile(filename, value, key)
-    cros_build_lib.RunGitCommand(cwd, ['add', filename])
-    cros_build_lib.RunGitCommand(cwd, ['commit', '-m', description])
-    cros_build_lib.GitPushWithRetry(prebuilt_branch, cwd, dryrun=dryrun,
-                                    retries=retries)
+    git.RunGit(cwd, ['add', filename])
+    git.RunGit(cwd, ['commit', '-m', description])
+    git.PushWithRetry(prebuilt_branch, cwd, dryrun=dryrun, retries=retries)
   finally:
     cros_build_lib.RunCommand(['git', 'checkout', commit], cwd=cwd)