コード例 #1
0
    def mercurial_bootstrap(self, update_only=False):
        sys.path.append(os.path.dirname(__file__))


        config_paths = ['~/.hgrc']
        if sys.platform in ('win32', 'cygwin'):
            config_paths.insert(0, '~/mercurial.ini')
        config_paths = map(os.path.expanduser, config_paths)

        if update_only:
            from hgsetup.update import MercurialUpdater
            updater = MercurialUpdater(self._context.state_dir)
            result = updater.update_all(map(os.path.expanduser, config_paths))
        else:
            from hgsetup.wizard import MercurialSetupWizard
            wizard = MercurialSetupWizard(self._context.state_dir)
            result = wizard.run(map(os.path.expanduser, config_paths))

        # Touch a file so we can periodically prompt to update extensions.
        state_path = os.path.join(self._context.state_dir,
            'mercurial/setup.lastcheck')
        with open(state_path, 'a'):
            os.utime(state_path, None)

        return result
コード例 #2
0
ファイル: mach_commands.py プロジェクト: MekliCZ/positron
    def mercurial_setup(self, update_only=False):
        """Ensure Mercurial is optimally configured.

        This command will inspect your Mercurial configuration and
        guide you through an interactive wizard helping you configure
        Mercurial for optimal use on Mozilla projects.

        User choice is respected: no changes are made without explicit
        confirmation from you.

        If "--update-only" is used, the interactive wizard is disabled
        and this command only ensures that remote repositories providing
        Mercurial extensions are up to date.
        """
        sys.path.append(os.path.dirname(__file__))

        config_paths = ['~/.hgrc']
        if sys.platform in ('win32', 'cygwin'):
            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)
            result = updater.update_all()
        else:
            from hgsetup.wizard import MercurialSetupWizard
            wizard = MercurialSetupWizard(self._context.state_dir)
            result = wizard.run(map(os.path.expanduser, config_paths))

        if result:
            print('(despite the failure, mach will not nag you to run '
                  '`mach mercurial-setup`)')

        return result
コード例 #3
0
    def mercurial_setup(self, update_only=False):
        """Ensure Mercurial is optimally configured.

        This command will inspect your Mercurial configuration and
        guide you through an interactive wizard helping you configure
        Mercurial for optimal use on Mozilla projects.

        User choice is respected: no changes are made without explicit
        confirmation from you.

        If "--update-only" is used, the interactive wizard is disabled
        and this command only ensures that remote repositories providing
        Mercurial extensions are up to date.
        """
        sys.path.append(os.path.dirname(__file__))

        config_paths = ['~/.hgrc']
        if sys.platform in ('win32', 'cygwin'):
            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)
            result = updater.update_all()
        else:
            from hgsetup.wizard import MercurialSetupWizard
            wizard = MercurialSetupWizard(self._context.state_dir)
            result = wizard.run(map(os.path.expanduser, config_paths))

        if result:
            print('(despite the failure, mach will not nag you to run '
                  '`mach mercurial-setup`)')

        return result
コード例 #4
0
    def mercurial_bootstrap(self):
        sys.path.append(os.path.dirname(__file__))

        from hgsetup.wizard import MercurialSetupWizard

        wizard = MercurialSetupWizard(self._context.state_dir)
        result = wizard.run(os.path.expanduser('~/.hgrc'))

        # Touch a file so we can periodically prompt to update extensions.
        state_path = os.path.join(self._context.state_dir,
            'mercurial/setup.lastcheck')
        with open(state_path, 'a'):
            os.utime(state_path, None)

        return result