Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Unified Diff: gclient_scm.py

Issue 10454088: Automatically update submodule config entries on sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
===================================================================
--- gclient_scm.py (revision 140344)
+++ gclient_scm.py (working copy)
@@ -194,6 +194,21 @@
cwd=self.checkout_path,
filter_fn=GitDiffFilterer(self.relpath).Filter)
+ def UpdateSubmoduleConfig(self):
+ submod_cmd = ['git', 'config', '-f', '$toplevel/.git/config',
+ 'submodule.$name.ignore', '||',
+ 'git', 'config', '-f', '$toplevel/.git/config',
+ 'submodule.$name.ignore', 'dirty']
+ cmd = ['git', 'submodule', '--quiet', 'foreach', ' '.join(submod_cmd)]
+ try:
+ gclient_utils.CheckCallAndFilter(
+ cmd, cwd=self.checkout_path, print_stdout=False,
+ filter_fn=lambda x: None)
+ except subprocess2.CalledProcessError:
+ # Not a fatal error, or even very interesting in a non-git-submodule
+ # world. So just keep it quiet.
+ pass
+
def update(self, options, args, file_list):
"""Runs git to update or transparently checkout the working copy.
@@ -254,6 +269,7 @@
not os.listdir(self.checkout_path)):
gclient_utils.safe_makedirs(os.path.dirname(self.checkout_path))
self._Clone(revision, url, options)
+ self.UpdateSubmoduleConfig()
files = self._Capture(['ls-files']).splitlines()
file_list.extend([os.path.join(self.checkout_path, f) for f in files])
if not verbose:
@@ -290,6 +306,7 @@
quiet = ['--quiet']
self._Run(['fetch', 'origin', '--prune'] + quiet, options)
self._Run(['reset', '--hard', 'origin/master'] + quiet, options)
+ self.UpdateSubmoduleConfig()
files = self._Capture(['ls-files']).splitlines()
file_list.extend([os.path.join(self.checkout_path, f) for f in files])
return
@@ -461,6 +478,7 @@
# whitespace between projects when syncing.
print('')
+ self.UpdateSubmoduleConfig()
file_list.extend([os.path.join(self.checkout_path, f) for f in files])
# If the rebase generated a conflict, abort and ask user to fix
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698