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

Unified Diff: git_cl.py

Issue 104043008: Added --(de)activate-update options (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Style fixes Created 6 years, 12 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/git_cl_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index a360cff377712e6b7f883d8f2ec450113202df9d..9d7cb4e519e2a4c73ab80d9cb82ca049434812a4 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -267,9 +267,17 @@ class Settings(object):
def LazyUpdateIfNeeded(self):
"""Updates the settings from a codereview.settings file, if available."""
if not self.updated:
+ # The only value that actually changes the behavior is
+ # autoupdate = "false". Everything else means "true".
+ autoupdate = RunGit(['config', 'rietveld.autoupdate'],
+ error_ok=True
+ ).strip().lower()
+
cr_settings_file = FindCodereviewSettingsFile()
- if cr_settings_file:
+ if autoupdate != 'false' and cr_settings_file:
LoadCodereviewSettingsFromFile(cr_settings_file)
+ # set updated to True to avoid infinite calling loop
+ # through DownloadHooks
self.updated = True
DownloadHooks(False)
self.updated = True
@@ -1084,7 +1092,22 @@ def DownloadHooks(force):
def CMDconfig(parser, args):
"""Edits configuration for this tree."""
- _, args = parser.parse_args(args)
+ parser.add_option('--activate-update', action='store_true',
+ help='activate auto-updating [rietveld] section in '
+ '.git/config')
+ parser.add_option('--deactivate-update', action='store_true',
+ help='deactivate auto-updating [rietveld] section in '
+ '.git/config')
+ options, args = parser.parse_args(args)
+
+ if options.deactivate_update:
+ RunGit(['config', 'rietveld.autoupdate', 'false'])
+ return
+
+ if options.activate_update:
+ RunGit(['config', '--unset', 'rietveld.autoupdate'])
+ return
+
if len(args) == 0:
GetCodereviewSettingsInteractively()
DownloadHooks(True)
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698