tools/mercurial/mach_commands.py

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 # This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 # License, v. 2.0. If a copy of the MPL was not distributed with this,
michael@0 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 4
michael@0 5 from __future__ import print_function, unicode_literals
michael@0 6
michael@0 7 import os
michael@0 8 import sys
michael@0 9
michael@0 10 from mach.decorators import (
michael@0 11 CommandProvider,
michael@0 12 Command,
michael@0 13 )
michael@0 14
michael@0 15
michael@0 16 @CommandProvider
michael@0 17 class VersionControlCommands(object):
michael@0 18 def __init__(self, context):
michael@0 19 self._context = context
michael@0 20
michael@0 21 @Command('mercurial-setup', category='devenv',
michael@0 22 description='Help configure Mercurial for optimal development.')
michael@0 23 def mercurial_bootstrap(self):
michael@0 24 sys.path.append(os.path.dirname(__file__))
michael@0 25
michael@0 26 from hgsetup.wizard import MercurialSetupWizard
michael@0 27
michael@0 28 wizard = MercurialSetupWizard(self._context.state_dir)
michael@0 29 config_paths = ['~/.hgrc']
michael@0 30 if sys.platform in ('win32', 'cygwin'):
michael@0 31 config_paths.insert(0, '~/mercurial.ini')
michael@0 32 result = wizard.run(map(os.path.expanduser, config_paths))
michael@0 33
michael@0 34 # Touch a file so we can periodically prompt to update extensions.
michael@0 35 state_path = os.path.join(self._context.state_dir,
michael@0 36 'mercurial/setup.lastcheck')
michael@0 37 with open(state_path, 'a'):
michael@0 38 os.utime(state_path, None)
michael@0 39
michael@0 40 return result

mercurial