Commit 260c6533 authored by msb@chromium.org's avatar msb@chromium.org

Add directory check to Git revert.

Review URL: http://codereview.chromium.org/339037

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@30317 0039d316-1c4b-4281-b951-d872f2087c98
parent 9e890f92
......@@ -153,6 +153,13 @@ class GitWrapper(SCMWrapper):
All reverted files will be appended to file_list.
"""
path = os.path.join(self._root_dir, self.relpath)
if not os.path.isdir(path):
# revert won't work if the directory doesn't exist. It needs to
# checkout instead.
print("\n_____ %s is missing, synching instead" % self.relpath)
# Don't reuse the args.
return self.update(options, [], file_list)
merge_base = self._RunGit(['merge-base', 'HEAD', 'origin'])
files = self._RunGit(['diff', merge_base, '--name-only']).split()
print self._RunGit(['reset', '--hard', merge_base])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment