Chromium Code Reviews| Index: git_cl.py |
| diff --git a/git_cl.py b/git_cl.py |
| index fa04059d9b5eb1d72eeeb11eba14e18af6b3e0d9..cc21c7101b05699a77c0ff1485b20f621e75204f 100755 |
| --- a/git_cl.py |
| +++ b/git_cl.py |
| @@ -267,9 +267,16 @@ 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 |
|
ghost stip (do not use)
2014/01/03 20:40:21
style nit: put error_ok on the next line (+4)
|
| + ).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 |
| @@ -1079,7 +1086,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) |