Commit 27c9c8af authored by smut@google.com's avatar smut@google.com

Revert "Make check for dirty index work."

This reverts commit 931b6c6a.

This was causing our try bots to fail on DEPS changes.

After applying the patch successfully, apply_issue.py tries to run gclient sync to get the updated DEPS, resulting in this error:
src (ERROR)
----------------------------------------
[0:00:00] Started.
----------------------------------------
Error: 
____ src at origin/master
	Your index contains uncommitted changes
	Please commit, stash, or reset.

BUG=413326
TESTED=Manually: https://paste.googleplex.com/6375653263802368

Review URL: https://codereview.chromium.org/563873002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291932 0039d316-1c4b-4281-b951-d872f2087c98
parent b99fbd9c
......@@ -612,10 +612,9 @@ class GitWrapper(SCMWrapper):
return
else:
self.Print('Input not recognized')
elif re.match("error: Your local changes to (')?.*(')? would be "
"overwritten by merge(. Aborting)?[:.]\n(.*\n)?Please, "
"commit your changes or stash them before you can "
"merge.\n",
elif re.match("error: Your local changes to '.*' would be "
"overwritten by merge. Aborting.\nPlease, commit your "
"changes or stash them before you can merge.\n",
e.stderr):
if not printed_path:
self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False)
......@@ -1022,7 +1021,7 @@ class GitWrapper(SCMWrapper):
% (self.relpath, rev_str))
try:
scm.GIT.Capture(['diff-index', '--cached', '--name-status', '-r',
'--ignore-submodules', '--exit-code', 'HEAD', '--'],
'--ignore-submodules', 'HEAD', '--'],
cwd=self.checkout_path)
except subprocess2.CalledProcessError:
raise gclient_utils.Error('\n____ %s%s\n'
......
......@@ -919,14 +919,6 @@ from :3
return return_value
return AskForData
def getCurrentBranch(self):
# Returns name of current branch or HEAD for detached HEAD
branch = gclient_scm.scm.GIT.Capture(['rev-parse', '--abbrev-ref', 'HEAD'],
cwd=self.base_path)
if branch == 'HEAD':
return None
return branch
def setUp(self):
TestCaseUtils.setUp(self)
unittest.TestCase.setUp(self)
......@@ -1208,44 +1200,12 @@ class ManagedGitWrapperTestCase(BaseGitWrapperTestCase):
'Fix the conflict and run gclient again.\n'
'See \'man git-rebase\' for details.\n')
self.assertRaisesError(exception, scm.update, options, (), [])
# The merge conflict creates a detached head with local changes, so another
# scm.update attempt should fail (in a different way) because of that (a
# rather roundabout way to test that condition).
exception = ('\n____ . at refs/remotes/origin/master\n'
'\tYou have unstaged changes.\n'
'\tPlease commit, stash, or reset.\n')
self.assertRaisesError(exception, scm.update, options, (), [])
sys.stdout.close()
def testUpdateDetachedConflict(self):
# Detached head mode should refuse to update when there are local changes
# (staged or unstaged).
if not self.enabled:
return
options = self.Options()
scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir,
relpath=self.relpath)
scm._Run(['checkout', '-q', 'a7142dc9f0009350b96a11f372b6ea658592aa95'],
options)
# Make sure it checked out a detached HEAD
self.assertEquals(self.getCurrentBranch(), None)
file_path = join(self.base_path, 'b')
open(file_path, 'w').writelines('conflict\n')
# Unstaged
# TODO(all): Ick. Gclient should really have exception subclasses or
# something, so we can avoid this fragile exception message matching.
exception = ('\n____ . at refs/remotes/origin/master\n'
'\tYou have unstaged changes.\n'
'\tPlease commit, stash, or reset.\n')
self.assertRaisesError(exception, scm.update, options, (), [])
# Staged
scm._Run(['add', 'b'], options)
exception = ('\n____ . at refs/remotes/origin/master\n'
'\tYour index contains uncommitted changes\n'
'\tPlease commit, stash, or reset.\n')
self.assertRaisesError(exception, scm.update, options, (), [])
sys.stdout.close()
def testRevinfo(self):
if not self.enabled:
return
......@@ -1469,6 +1429,14 @@ class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase):
# pylint: disable=E1101
self.assertNotIn(expected, value)
def getCurrentBranch(self):
# Returns name of current branch or HEAD for detached HEAD
branch = gclient_scm.scm.GIT.Capture(['rev-parse', '--abbrev-ref', 'HEAD'],
cwd=self.base_path)
if branch == 'HEAD':
return None
return branch
def testUpdateClone(self):
if not self.enabled:
return
......
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