Bug 1277406 - Remove nagging to run mach mercurial-setup from mach; r=glandium
I never really liked this. Other people had even more visceral reactions. Let's get rid of it. The code for touching a file when it runs has also been removed because the only thing it was used for was the nagging feature. MozReview-Commit-ID: ERUVkEYgkzx
This commit is contained in:
@@ -31,26 +31,6 @@ want to export this environment variable from your shell's init scripts.
|
||||
Press ENTER/RETURN to continue or CTRL+c to abort.
|
||||
'''.lstrip()
|
||||
|
||||
NO_MERCURIAL_SETUP = '''
|
||||
*** MERCURIAL NOT CONFIGURED ***
|
||||
|
||||
mach has detected that you have never run `{mach} mercurial-setup`.
|
||||
|
||||
Running this command will ensure your Mercurial version control tool is up
|
||||
to date and optimally configured for a better, more productive experience
|
||||
when working on Mozilla projects.
|
||||
|
||||
Please run `{mach} mercurial-setup` now.
|
||||
|
||||
Note: `{mach} mercurial-setup` does not make any changes without prompting
|
||||
you first.
|
||||
|
||||
You can disable this check by setting NO_MERCURIAL_SETUP_CHECK=1 in your
|
||||
environment.
|
||||
'''.strip()
|
||||
|
||||
MERCURIAL_SETUP_FATAL_INTERVAL = 31 * 24 * 60 * 60
|
||||
|
||||
|
||||
# TODO Bug 794506 Integrate with the in-tree virtualenv configuration.
|
||||
SEARCH_PATHS = [
|
||||
@@ -294,43 +274,6 @@ def bootstrap(topsrcdir, mozilla_dir=None):
|
||||
|
||||
return False
|
||||
|
||||
def pre_dispatch_handler(context, handler, args):
|
||||
"""Perform global checks before command dispatch.
|
||||
|
||||
Currently, our goal is to ensure developers periodically run
|
||||
`mach mercurial-setup` (when applicable) to ensure their Mercurial
|
||||
tools are up to date.
|
||||
"""
|
||||
# Don't do anything when...
|
||||
if should_skip_dispatch(context, handler):
|
||||
return
|
||||
|
||||
# User has disabled first run check.
|
||||
if 'I_PREFER_A_SUBOPTIMAL_MERCURIAL_EXPERIENCE' in os.environ:
|
||||
return
|
||||
if 'NO_MERCURIAL_SETUP_CHECK' in os.environ:
|
||||
return
|
||||
|
||||
# Mercurial isn't managing this source checkout.
|
||||
if not os.path.exists(os.path.join(topsrcdir, '.hg')):
|
||||
return
|
||||
|
||||
state_dir = get_state_dir()[0]
|
||||
last_check_path = os.path.join(state_dir, 'mercurial',
|
||||
'setup.lastcheck')
|
||||
|
||||
mtime = None
|
||||
try:
|
||||
mtime = os.path.getmtime(last_check_path)
|
||||
except OSError as e:
|
||||
if e.errno != errno.ENOENT:
|
||||
raise
|
||||
|
||||
# No last run file means mercurial-setup has never completed.
|
||||
if mtime is None:
|
||||
print(NO_MERCURIAL_SETUP.format(mach=sys.argv[0]), file=sys.stderr)
|
||||
sys.exit(2)
|
||||
|
||||
def post_dispatch_handler(context, handler, args):
|
||||
"""Perform global operations after command dispatch.
|
||||
|
||||
@@ -387,9 +330,6 @@ def bootstrap(topsrcdir, mozilla_dir=None):
|
||||
if key == 'topdir':
|
||||
return topsrcdir
|
||||
|
||||
if key == 'pre_dispatch_handler':
|
||||
return pre_dispatch_handler
|
||||
|
||||
if key == 'telemetry_handler':
|
||||
return telemetry_handler
|
||||
|
||||
|
||||
@@ -44,20 +44,6 @@ class VersionControlCommands(object):
|
||||
config_paths.insert(0, '~/mercurial.ini')
|
||||
config_paths = map(os.path.expanduser, config_paths)
|
||||
|
||||
# Touch a file so we can periodically prompt to update extensions.
|
||||
#
|
||||
# We put this before main command logic because the command can
|
||||
# persistently fail and we want people to get credit for the
|
||||
# intention, not whether the command is bug free.
|
||||
state_dir = os.path.join(self._context.state_dir, 'mercurial')
|
||||
if not os.path.isdir(state_dir):
|
||||
os.makedirs(state_dir)
|
||||
|
||||
state_path = os.path.join(state_dir, 'setup.lastcheck')
|
||||
|
||||
with open(state_path, 'a'):
|
||||
os.utime(state_path, None)
|
||||
|
||||
if update_only:
|
||||
from hgsetup.update import MercurialUpdater
|
||||
updater = MercurialUpdater(self._context.state_dir)
|
||||
|
||||
Reference in New Issue
Block a user