Commit 3dc5cb77 authored by szager@chromium.org's avatar szager@chromium.org

Revert "If managed=False, don't fetch."

This reverts commit 617a1617.

BUG=385417
TBR=hinoka@chromium.org,agable@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@277766 0039d316-1c4b-4281-b951-d872f2087c98
parent 323ec375
...@@ -356,13 +356,6 @@ class GitWrapper(SCMWrapper): ...@@ -356,13 +356,6 @@ class GitWrapper(SCMWrapper):
verbose = ['--verbose'] verbose = ['--verbose']
printed_path = True printed_path = True
if not managed:
self.Print('________ unmanaged solution; skipping %s' % self.relpath)
try:
return self._Capture(['rev-parse', '--verify', 'HEAD'])
except subprocess2.CalledProcessError:
return None
url = self._CreateOrUpdateCache(url, options) url = self._CreateOrUpdateCache(url, options)
if revision.startswith('refs/'): if revision.startswith('refs/'):
...@@ -396,6 +389,11 @@ class GitWrapper(SCMWrapper): ...@@ -396,6 +389,11 @@ class GitWrapper(SCMWrapper):
self.Print('') self.Print('')
return self._Capture(['rev-parse', '--verify', 'HEAD']) return self._Capture(['rev-parse', '--verify', 'HEAD'])
if not managed:
self._UpdateBranchHeads(options, fetch=False)
self.Print('________ unmanaged solution; skipping %s' % self.relpath)
return self._Capture(['rev-parse', '--verify', 'HEAD'])
# See if the url has changed (the unittests use git://foo for the url, let # See if the url has changed (the unittests use git://foo for the url, let
# that through). # that through).
current_url = self._Capture(['config', 'remote.%s.url' % self.remote]) current_url = self._Capture(['config', 'remote.%s.url' % self.remote])
......
...@@ -1413,17 +1413,19 @@ class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase): ...@@ -1413,17 +1413,19 @@ class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase):
root_dir=self.root_dir, root_dir=self.root_dir,
relpath=self.relpath) relpath=self.relpath)
expected_file_list = [join(self.base_path, "a"),
join(self.base_path, "b")]
file_list = [] file_list = []
options.revision = 'unmanaged' options.revision = 'unmanaged'
scm.update(options, (), file_list) scm.update(options, (), file_list)
self.assertEquals(file_list, []) self.assertEquals(file_list, expected_file_list)
self.assertRaises(subprocess2.CalledProcessError, self.assertEquals(scm.revinfo(options, (), None),
scm.revinfo, options, (), None) '069c602044c5388d2d15c3f875b057c852003458')
# indicates detached HEAD # indicates detached HEAD
self.assertRaises(subprocess2.CalledProcessError, self.getCurrentBranch) self.assertEquals(self.getCurrentBranch(), None)
self.checkInStdout('unmanaged solution; skipping') self.checkInStdout(
'Checked out refs/remotes/origin/master to a detached HEAD')
rmtree(origin_root_dir) rmtree(origin_root_dir)
...@@ -1443,16 +1445,19 @@ class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase): ...@@ -1443,16 +1445,19 @@ class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase):
root_dir=self.root_dir, root_dir=self.root_dir,
relpath=self.relpath) relpath=self.relpath)
expected_file_list = [join(self.base_path, "a"),
join(self.base_path, "b")]
file_list = [] file_list = []
options.revision = 'unmanaged' options.revision = 'unmanaged'
scm.update(options, (), file_list) scm.update(options, (), file_list)
self.assertEquals(file_list, []) self.assertEquals(file_list, expected_file_list)
self.assertRaises(subprocess2.CalledProcessError, self.assertEquals(scm.revinfo(options, (), None),
scm.revinfo, options, (), None) 'a7142dc9f0009350b96a11f372b6ea658592aa95')
# indicates detached HEAD # indicates detached HEAD
self.assertRaises(subprocess2.CalledProcessError, self.getCurrentBranch) self.assertEquals(self.getCurrentBranch(), None)
self.checkInStdout('unmanaged solution; skipping') self.checkInStdout(
'Checked out a7142dc9f0009350b96a11f372b6ea658592aa95 to a detached HEAD')
rmtree(origin_root_dir) rmtree(origin_root_dir)
...@@ -1471,14 +1476,17 @@ class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase): ...@@ -1471,14 +1476,17 @@ class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase):
root_dir=self.root_dir, root_dir=self.root_dir,
relpath=self.relpath) relpath=self.relpath)
expected_file_list = [join(self.base_path, "a"),
join(self.base_path, "b"),
join(self.base_path, "c")]
file_list = [] file_list = []
options.revision = 'unmanaged' options.revision = 'unmanaged'
scm.update(options, (), file_list) scm.update(options, (), file_list)
self.assertEquals(file_list, []) self.assertEquals(file_list, expected_file_list)
self.assertRaises(subprocess2.CalledProcessError, self.assertEquals(scm.revinfo(options, (), None),
scm.revinfo, options, (), None) '9a51244740b25fa2ded5252ca00a3178d3f665a9')
self.assertRaises(subprocess2.CalledProcessError, self.getCurrentBranch) self.assertEquals(self.getCurrentBranch(), 'feature')
self.checkNotInStdout('Checked out feature to a detached HEAD') self.checkNotInStdout('Checked out feature to a detached HEAD')
rmtree(origin_root_dir) rmtree(origin_root_dir)
...@@ -1498,16 +1506,20 @@ class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase): ...@@ -1498,16 +1506,20 @@ class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase):
root_dir=self.root_dir, root_dir=self.root_dir,
relpath=self.relpath) relpath=self.relpath)
expected_file_list = [join(self.base_path, "a"),
join(self.base_path, "b"),
join(self.base_path, "c")]
file_list = [] file_list = []
options.revision = 'unmanaged' options.revision = 'unmanaged'
scm.update(options, (), []) scm.update(options, (), file_list)
self.assertEquals(file_list, []) self.assertEquals(file_list, expected_file_list)
self.assertRaises(subprocess2.CalledProcessError, self.assertEquals(scm.revinfo(options, (), None),
scm.revinfo, options, (), None) '9a51244740b25fa2ded5252ca00a3178d3f665a9')
# indicates detached HEAD # indicates detached HEAD
self.assertRaises(subprocess2.CalledProcessError, self.getCurrentBranch) self.assertEquals(self.getCurrentBranch(), None)
self.checkInStdout('unmanaged solution; skipping') self.checkInStdout(
'Checked out refs/remotes/origin/feature to a detached HEAD')
rmtree(origin_root_dir) rmtree(origin_root_dir)
...@@ -1526,14 +1538,17 @@ class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase): ...@@ -1526,14 +1538,17 @@ class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase):
root_dir=self.root_dir, root_dir=self.root_dir,
relpath=self.relpath) relpath=self.relpath)
expected_file_list = [join(self.base_path, "a"),
join(self.base_path, "b"),
join(self.base_path, "c")]
file_list = [] file_list = []
options.revision = 'unmanaged' options.revision = 'unmanaged'
scm.update(options, (), file_list) scm.update(options, (), file_list)
self.assertEquals(file_list, []) self.assertEquals(file_list, expected_file_list)
self.assertRaises(subprocess2.CalledProcessError, self.assertEquals(scm.revinfo(options, (), None),
scm.revinfo, options, (), None) '9a51244740b25fa2ded5252ca00a3178d3f665a9')
self.assertRaises(subprocess2.CalledProcessError, self.getCurrentBranch) self.assertEquals(self.getCurrentBranch(), 'feature')
self.checkNotInStdout( self.checkNotInStdout(
'Checked out refs/heads/feature to a detached HEAD') 'Checked out refs/heads/feature to a detached HEAD')
......
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