Reland "Make gclient ready for the Blink (DEPS to main project)"
Reland crrev.com/743083002, which was reverted in crrev.com/796053002
due to some test flakiness, probably related with an old version of Git on
the bots. Relanding now that the infra has been updated to Trusty (plus
adding some de-flake precautions).
Original CL Description:
Make gclient ready for the Blink (DEPS to main project) transition
This CL makes gclient understand correctly whether a git project is
being moved from DEPS to an upper project and vice-versa.
The driving use case for this is the upcoming Blink merge, where
third_party/Webkit will be removed from DEPS (and .gitignore) and will
become part of the main project.
At present state, gclient leaves the .git folder around when a project
is removed from DEPS, and that causes many problems.
Furthermore this CL solves the performance problem of bisecting across
the merge point. The subproject's (Blink) .git/ folder is moved to a
backup location (in the main checkout root) and is restored when moving
backwards, avoiding a re-fetch when bisecting across the merge point.
BUG=431469
Review URL: https://codereview.chromium.org/910913003
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@294082 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/scm.py b/scm.py
index 9bc96bc..94b925e 100644
--- a/scm.py
+++ b/scm.py
@@ -443,6 +443,16 @@
return False
@staticmethod
+ def IsDirectoryVersioned(cwd, relative_dir):
+ """Checks whether the given |relative_dir| is part of cwd's repo."""
+ return bool(GIT.Capture(['ls-tree', 'HEAD', relative_dir], cwd=cwd))
+
+ @staticmethod
+ def CleanupDir(cwd, relative_dir):
+ """Cleans up untracked file inside |relative_dir|."""
+ return bool(GIT.Capture(['clean', '-df', relative_dir], cwd=cwd))
+
+ @staticmethod
def GetGitSvnHeadRev(cwd):
"""Gets the most recently pulled git-svn revision."""
try: