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) |