gclient_scm: Don't try to update file_list if it's None.

file_list can be none if gclient runs with --nohooks.
Fix apply_patch_ref so that it doesn't try to update file_list when it is
None.

TBR=agable@chromium.org

Bug: 643346
Change-Id: If00547da004415edfe68196a44cbda753b4db017
Reviewed-on: https://chromium-review.googlesource.com/989279
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
changes/79/989279/5
Edward Lesmes 8 years ago committed by Commit Bot
parent 012013ee59
commit 8271d22542

@ -347,7 +347,8 @@ class GitWrapper(SCMWrapper):
patch_repo, patch_ref, base_rev, self.checkout_path))
self._Capture(['reset', '--hard'])
self._Capture(['fetch', patch_repo, patch_ref])
file_list.extend(self._GetDiffFilenames('FETCH_HEAD'))
if file_list is not None:
file_list.extend(self._GetDiffFilenames('FETCH_HEAD'))
self._Capture(['checkout', 'FETCH_HEAD'])
if options.rebase_patch_ref:

@ -1,3 +1,4 @@
No-op file. Edit this to kick recipes. Yep. Ack.
No-op file. Edit this to kick recipes.
This is a beginning of a story in this silly file.
Once upon a time,

@ -536,7 +536,7 @@ class GClientSmokeGIT(GClientSmokeBase):
tree['src/git_hooked2'] = 'git_hooked2'
self.assertTree(tree)
def testSyncGerritRef(self):
def testSyncPatchRef(self):
if not self.enabled:
return
self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
@ -559,6 +559,28 @@ class GClientSmokeGIT(GClientSmokeBase):
self.githash('repo_2', 1),
self.gitrevparse(os.path.join(self.root_dir, 'src/repo2')))
def testSyncPatchRefNoHooks(self):
if not self.enabled:
return
self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
self.gclient([
'sync', '-v', '-v', '-v',
'--revision', 'src/repo2@%s' % self.githash('repo_2', 1),
'--patch-ref',
'%srepo_2@%s' % (self.git_base, self.githash('repo_2', 2)),
'--nohooks',
])
# Assert that repo_2 files coincide with revision @2 (the patch ref)
tree = self.mangle_git_tree(('repo_1@2', 'src'),
('repo_2@2', 'src/repo2'),
('repo_3@2', 'src/repo2/repo_renamed'))
self.assertTree(tree)
# Assert that HEAD revision of repo_2 is @1 (the base we synced to) since we
# should have done a soft reset.
self.assertEqual(
self.githash('repo_2', 1),
self.gitrevparse(os.path.join(self.root_dir, 'src/repo2')))
def testRunHooks(self):
if not self.enabled:
return

Loading…
Cancel
Save