Пример #1
0
    def settings_mapping(self):
        """GET /admin/settings/mapping: All items in the collection"""
        # url('admin_settings_mapping')
        c.active = 'mapping'
        if request.POST:
            rm_obsolete = request.POST.get('destroy', False)
            install_git_hooks = request.POST.get('hooks', False)
            invalidate_cache = request.POST.get('invalidate', False)
            log.debug('rescanning repo location with destroy obsolete=%s and '
                      'install git hooks=%s' % (rm_obsolete,install_git_hooks))

            if invalidate_cache:
                log.debug('invalidating all repositories cache')
                for repo in Repository.get_all():
                    ScmModel().mark_for_invalidation(repo.repo_name, delete=True)

            filesystem_repos = ScmModel().repo_scan()
            added, removed = repo2db_mapper(filesystem_repos, rm_obsolete,
                                            install_git_hook=install_git_hooks,
                                            user=c.authuser.username)
            h.flash(h.literal(_('Repositories successfully rescanned. Added: %s. Removed: %s.') %
                (', '.join(h.link_to(safe_unicode(repo_name), h.url('summary_home', repo_name=repo_name))
                 for repo_name in added) or '-',
                 ', '.join(h.escape(safe_unicode(repo_name)) for repo_name in removed) or '-')),
                category='success')
            return redirect(url('admin_settings_mapping'))

        defaults = Setting.get_app_settings()
        defaults.update(self._get_hg_ui_settings())

        return htmlfill.render(
            render('admin/settings/settings.html'),
            defaults=defaults,
            encoding="UTF-8",
            force_defaults=False)
    def test_push_new_file_git(self):
        DEST = _get_tmp_dir()
        clone_url = _construct_url(GIT_REPO, dest=DEST)
        stdout, stderr = Command('/tmp').execute('git clone', clone_url)

        # commit some stuff into this repo
        stdout, stderr = _add_files_and_push('git', DEST)

        print [(x.repo_full_path,x.repo_path) for x in Repository.get_all()]
Пример #3
0
    def test_push_new_file_git(self):
        DEST = _get_tmp_dir()
        clone_url = _construct_url(GIT_REPO, dest=DEST)
        stdout, stderr = Command('/tmp').execute('git clone', clone_url)

        # commit some stuff into this repo
        stdout, stderr = _add_files_and_push('git', DEST)

        print [(x.repo_full_path,x.repo_path) for x in Repository.get_all()]
        _check_proper_git_push(stdout, stderr)