Gerrit: announce deprecation of auto-download of commit-msg hook.

BUG=579176

Review URL: https://codereview.chromium.org/1764453002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299095 0039d316-1c4b-4281-b951-d872f2087c98
changes/01/332501/1
tandrii@chromium.org 9 years ago
parent 65874e1466
commit 18630d61d2

@ -602,9 +602,9 @@ class Settings(object):
if autoupdate != 'false' and cr_settings_file: if autoupdate != 'false' and cr_settings_file:
LoadCodereviewSettingsFromFile(cr_settings_file) LoadCodereviewSettingsFromFile(cr_settings_file)
# set updated to True to avoid infinite calling loop # set updated to True to avoid infinite calling loop
# through DownloadHooks # through DownloadGerritHook
self.updated = True self.updated = True
DownloadHooks(False) DownloadGerritHook(False)
self.updated = True self.updated = True
def GetDefaultServerUrl(self, error_ok=False): def GetDefaultServerUrl(self, error_ok=False):
@ -1570,8 +1570,8 @@ def hasSheBang(fname):
return f.read(2).startswith('#!') return f.read(2).startswith('#!')
def DownloadHooks(force): def DownloadGerritHook(force):
"""downloads hooks """Download and install Gerrit commit-msg hook.
Args: Args:
force: True to update hooks. False to install hooks if not present. force: True to update hooks. False to install hooks if not present.
@ -1585,6 +1585,10 @@ def DownloadHooks(force):
if not force: if not force:
return return
try: try:
print(
'WARNING: installing Gerrit commit-msg hook.\n'
' This behavior of git cl will soon be disabled.\n'
' See bug http://crbug.com/579176.')
urlretrieve(src, dst) urlretrieve(src, dst)
if not hasSheBang(dst): if not hasSheBang(dst):
DieWithError('Not a script: %s\n' DieWithError('Not a script: %s\n'
@ -1623,7 +1627,7 @@ def CMDconfig(parser, args):
if len(args) == 0: if len(args) == 0:
GetCodereviewSettingsInteractively() GetCodereviewSettingsInteractively()
DownloadHooks(True) DownloadGerritHook(True)
return 0 return 0
url = args[0] url = args[0]
@ -1632,7 +1636,7 @@ def CMDconfig(parser, args):
# Load code review settings and download hooks (if available). # Load code review settings and download hooks (if available).
LoadCodereviewSettingsFromFile(urllib2.urlopen(url)) LoadCodereviewSettingsFromFile(urllib2.urlopen(url))
DownloadHooks(True) DownloadGerritHook(True)
return 0 return 0

Loading…
Cancel
Save