\
- {id} (hg: {hg-version}, py: {python-version}, size: {size:fileSize})\
-
',
-
- // text
- backText: 'Back',
- nextText: 'Next',
- finishText: 'Finish',
- configureLocalText: 'Configure local installation',
- configureRemoteText: 'Download and install',
- loadingText: 'Loading ...',
- hgInstallationText: 'Mercurial Installation',
- pythonInstallationText: 'Python Installation',
- hgPackageText: 'Mercurial Package',
- errorTitleText: 'Error',
- packageInstallationFailedText: 'Package installation failed',
- installPackageText: 'install mercurial package {0}',
-
- initComponent: function(){
- this.addEvents('finish');
-
- var packageStore = new Ext.data.JsonStore({
- storeId: 'pkgStore',
- proxy: new Ext.data.HttpProxy({
- url: restUrl + 'config/repositories/hg/packages.json',
- disableCaching: false
- }),
- fields: [ 'id', 'hg-version', 'python-version', 'size' ],
- root: 'package',
- listeners: {
- load: {
- fn: this.checkIfPackageAvailable,
- scope: this
- }
- }
- });
-
- var hgInstallationStore = new Ext.data.Store({
- proxy: new Ext.data.HttpProxy({
- url: restUrl + 'config/repositories/hg/installations/hg.json'
- }),
- fields: [ 'path' ],
- reader: new Sonia.hg.InstallationJsonReader(),
- autoLoad: true,
- autoDestroy: true
- });
-
- var pythonInstallationStore = new Ext.data.Store({
- proxy: new Ext.data.HttpProxy({
- url: restUrl + 'config/repositories/hg/installations/python.json'
- }),
- fields: [ 'path' ],
- reader: new Sonia.hg.InstallationJsonReader(),
- autoLoad: true,
- autoDestroy: true
- });
-
- var config = {
- layout: 'card',
- activeItem: 0,
- bodyStyle: 'padding: 5px',
- defaults: {
- bodyCssClass: 'x-panel-mc',
- border: false,
- labelWidth: 120,
- width: 250
- },
- bbar: ['->',{
- id: 'move-prev',
- text: this.backText,
- handler: this.navHandler.createDelegate(this, [-1]),
- disabled: true,
- scope: this
- },{
- id: 'move-next',
- text: this.nextText,
- handler: this.navHandler.createDelegate(this, [1]),
- scope: this
- },{
- id: 'finish',
- text: this.finishText,
- handler: this.applyChanges,
- scope: this,
- disabled: true
- }],
- items: [{
- id: 'cod',
- items: [{
- id: 'configureOrDownload',
- xtype: 'radiogroup',
- name: 'configureOrDownload',
- columns: 1,
- items: [{
- boxLabel: this.configureLocalText,
- name: 'cod',
- inputValue: 'localInstall',
- checked: true
- },{
- id: 'remoteInstallRadio',
- boxLabel: this.configureRemoteText,
- name: 'cod',
- inputValue: 'remoteInstall',
- disabled: true
- }]
- }],
- listeners: {
- render: {
- fn: function(panel){
- panel.body.mask(this.loadingText);
- var store = Ext.StoreMgr.lookup('pkgStore');
- store.load.defer(100, store);
- },
- scope: this
- }
- }
- },{
- id: 'localInstall',
- layout: 'form',
- defaults: {
- width: 250
- },
- items: [{
- id: 'mercurial',
- fieldLabel: this.hgInstallationText,
- name: 'mercurial',
- xtype: 'combo',
- readOnly: false,
- triggerAction: 'all',
- lazyRender: true,
- mode: 'local',
- editable: true,
- store: hgInstallationStore,
- valueField: 'path',
- displayField: 'path',
- allowBlank: false,
- value: this.hgConfig.hgBinary
- },{
- id: 'python',
- fieldLabel: this.pythonInstallationText,
- name: 'python',
- xtype: 'combo',
- readOnly: false,
- triggerAction: 'all',
- lazyRender: true,
- mode: 'local',
- editable: true,
- store: pythonInstallationStore,
- valueField: 'path',
- displayField: 'path',
- allowBlank: false,
- value: this.hgConfig.pythonBinary
- }]
- },{
- id: 'remoteInstall',
- layout: 'form',
- defaults: {
- width: 250
- },
- items: [{
- id: 'package',
- fieldLabel: this.hgPackageText,
- name: 'package',
- xtype: 'combo',
- readOnly: false,
- triggerAction: 'all',
- lazyRender: true,
- mode: 'local',
- editable: false,
- store: packageStore,
- valueField: 'id',
- displayField: 'id',
- allowBlank: false,
- tpl: this.packageTemplate,
- listeners: {
- select: function(){
- Ext.getCmp('finish').setDisabled(false);
- }
- }
- }]
- }]
- }
-
- Ext.apply(this, Ext.apply(this.initialConfig, config));
- Sonia.hg.ConfigWizardPanel.superclass.initComponent.apply(this, arguments);
- },
-
- checkIfPackageAvailable: function(store){
- Ext.getCmp('cod').body.unmask();
- var c = store.getTotalCount();
- if ( debug ){
- console.debug( "found " + c + " package(s)" );
- }
- if ( c > 0 ){
- Ext.getCmp('remoteInstallRadio').setDisabled(false);
- }
- },
-
- navHandler: function(direction){
- var layout = this.getLayout();
- var id = layout.activeItem.id;
-
- var next = -1;
-
- if ( id == 'cod' && direction == 1 ){
- var v = Ext.getCmp('configureOrDownload').getValue().getRawValue();
- var df = false;
- if ( v == 'localInstall' ){
- next = 1;
- } else if ( v == 'remoteInstall' ){
- next = 2;
- df = true;
- }
- Ext.getCmp('move-prev').setDisabled(false);
- Ext.getCmp('move-next').setDisabled(true);
- Ext.getCmp('finish').setDisabled(df);
- }
- else if (direction == -1 && (id == 'localInstall' || id == 'remoteInstall')) {
- next = 0;
- Ext.getCmp('move-prev').setDisabled(true);
- Ext.getCmp('move-next').setDisabled(false);
- Ext.getCmp('finish').setDisabled(true);
- }
-
- if ( next >= 0 ){
- layout.setActiveItem(next);
- }
- },
-
- applyChanges: function(){
- var v = Ext.getCmp('configureOrDownload').getValue().getRawValue();
- if ( v == 'localInstall' ){
- this.applyLocalConfiguration();
- } else if ( v == 'remoteInstall' ){
- this.applyRemoteConfiguration();
- }
- },
-
- applyRemoteConfiguration: function(){
- if ( debug ){
- console.debug( "apply remote configuration" );
- }
-
- var pkg = Ext.getCmp('package').getValue();
- if ( debug ){
- console.debug( 'install mercurial package ' + pkg );
- }
-
- var lbox = Ext.MessageBox.show({
- title: this.loadingText,
- msg: String.format(this.installPackageText, pkg),
- width: 300,
- wait: true,
- animate: true,
- progress: true,
- closable: false
- });
-
- Ext.Ajax.request({
- url: restUrl + 'config/repositories/hg/packages/' + pkg + '.json',
- method: 'POST',
- scope: this,
- timeout: 900000, // 15min
- success: function(){
- if ( debug ){
- console.debug('package successfully installed');
- }
- lbox.hide();
- this.fireEvent('finish');
- },
- failure: function(){
- if ( debug ){
- console.debug('package installation failed');
- }
- lbox.hide();
- Ext.MessageBox.show({
- title: this.errorTitleText,
- msg: this.packageInstallationFailedText,
- buttons: Ext.MessageBox.OK,
- icon:Ext.MessageBox.ERROR
- });
- }
- });
-
-
- },
-
- applyLocalConfiguration: function(){
- if ( debug ){
- console.debug( "apply remote configuration" );
- }
- var mercurial = Ext.getCmp('mercurial').getValue();
- var python = Ext.getCmp('python').getValue();
- if (debug){
- console.debug( 'configure mercurial=' + mercurial + " and python=" + python );
- }
- delete this.hgConfig.pythonPath;
- delete this.hgConfig.useOptimizedBytecode;
- this.hgConfig.hgBinary = mercurial;
- this.hgConfig.pythonBinary = python;
-
- if ( debug ){
- console.debug( this.hgConfig );
- }
-
- this.fireEvent('finish', this.hgConfig);
- }
-
-});
-
-// register xtype
-Ext.reg('hgConfigWizardPanel', Sonia.hg.ConfigWizardPanel);
-
-
-// i18n
-
-if ( i18n != null && i18n.country == 'de' ){
-
- Ext.override(Sonia.hg.ConfigWizardPanel, {
-
- backText: 'Zurück',
- nextText: 'Weiter',
- finishText: 'Fertigstellen',
- configureLocalText: 'Eine lokale Installation Konfigurieren',
- configureRemoteText: 'Herunterladen und installieren',
- loadingText: 'Lade ...',
- hgInstallationText: 'Mercurial Installation',
- pythonInstallationText: 'Python Installation',
- hgPackageText: 'Mercurial Package',
- errorTitleText: 'Fehler',
- packageInstallationFailedText: 'Package Installation fehlgeschlagen',
- installPackageText: 'Installiere Mercurial-Package {0}'
-
- });
-
-}
\ No newline at end of file
diff --git a/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hg.config.js b/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hg.config.js
deleted file mode 100644
index 1c234c9091..0000000000
--- a/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hg.config.js
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (c) 2010, Sebastian Sdorra
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of SCM-Manager; nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://bitbucket.org/sdorra/scm-manager
- *
- */
-
-
-Ext.ns("Sonia.hg");
-
-Sonia.hg.ConfigPanel = Ext.extend(Sonia.config.ConfigForm, {
-
- // labels
- titleText: 'Mercurial Settings',
- hgBinaryText: 'HG Binary',
- pythonBinaryText: 'Python Binary',
- pythonPathText: 'Python Module Search Path',
- repositoryDirectoryText: 'Repository directory',
- useOptimizedBytecodeText: 'Optimized Bytecode (.pyo)',
- configWizardText: 'Start Configuration Wizard',
- configWizardLabelText: 'Start Configuration Wizard',
-
- // helpText
- hgBinaryHelpText: 'Location of Mercurial binary.',
- pythonBinaryHelpText: 'Location of Python binary.',
- pythonPathHelpText: 'Python Module Search Path (PYTHONPATH).',
- repositoryDirectoryHelpText: 'Location of the Mercurial repositories.',
- useOptimizedBytecodeHelpText: 'Use the Python "-O" switch.',
-
- initComponent: function(){
-
- var config = {
- title : this.titleText,
- items : [{
- xtype : 'textfield',
- fieldLabel : this.hgBinaryText,
- name : 'hgBinary',
- allowBlank : false,
- helpText: this.hgBinaryHelpText
- },{
- xtype : 'textfield',
- fieldLabel : this.pythonBinaryText,
- name : 'pythonBinary',
- allowBlank : false,
- helpText: this.pythonBinaryHelpText
- },{
- xtype : 'textfield',
- fieldLabel : this.pythonPathText,
- name : 'pythonPath',
- helpText: this.pythonPathHelpText
- },{
- xtype: 'textfield',
- name: 'repositoryDirectory',
- fieldLabel: this.repositoryDirectoryText,
- helpText: this.repositoryDirectoryHelpText,
- allowBlank : false
- },{
- xtype: 'checkbox',
- name: 'useOptimizedBytecode',
- fieldLabel: this.useOptimizedBytecodeText,
- inputValue: 'true',
- helpText: this.useOptimizedBytecodeHelpText
- },{
- xtype: 'button',
- text: this.configWizardText,
- fieldLabel: this.configWizardLabelText,
- handler: function(){
- var config = this.getForm().getValues();
- var wizard = new Sonia.hg.ConfigWizard({
- hgConfig: config
- });
- wizard.on('finish', function(config){
- var self = Ext.getCmp('hgConfigForm');
- if ( config != null ){
- if (debug){
- console.debug( 'load config from wizard and submit to server' );
- }
- self.loadConfig( self.el, 'config/repositories/hg/auto-configuration.json', 'POST', config );
- } else {
- if (debug){
- console.debug( 'reload config' );
- }
- self.onLoad(self.el);
- }
- }, this);
- wizard.show();
- },
- scope: this
- }]
- }
-
- Ext.apply(this, Ext.apply(this.initialConfig, config));
- Sonia.hg.ConfigPanel.superclass.initComponent.apply(this, arguments);
- },
-
- onSubmit: function(values){
- this.el.mask(this.submitText);
- Ext.Ajax.request({
- url: restUrl + 'config/repositories/hg.json',
- method: 'POST',
- jsonData: values,
- scope: this,
- disableCaching: true,
- success: function(){
- this.el.unmask();
- },
- failure: function(){
- this.el.unmask();
- alert('failure');
- }
- });
- },
-
- onLoad: function(el){
- this.loadConfig(el, 'config/repositories/hg.json', 'GET');
- },
-
- loadConfig: function(el, url, method, config){
- var tid = setTimeout( function(){ el.mask(this.loadingText); }, 100);
- Ext.Ajax.request({
- url: restUrl + url,
- method: method,
- jsonData: config,
- scope: this,
- disableCaching: true,
- success: function(response){
- var obj = Ext.decode(response.responseText);
- this.load(obj);
- clearTimeout(tid);
- el.unmask();
- },
- failure: function(){
- el.unmask();
- clearTimeout(tid);
- alert('failure');
- }
- });
- }
-
-});
-
-Ext.reg("hgConfigPanel", Sonia.hg.ConfigPanel);
-
-// i18n
-
-if ( i18n != null && i18n.country == 'de' ){
-
- Ext.override(Sonia.hg.ConfigPanel, {
-
- // labels
- titleText: 'Mercurial Einstellungen',
- hgBinaryText: 'HG Pfad',
- pythonBinaryText: 'Python Pfad',
- pythonPathText: 'Python Modul Suchpfad',
- repositoryDirectoryText: 'Repository-Verzeichnis',
- useOptimizedBytecodeText: 'Optimierter Bytecode (.pyo)',
- autoConfigText: 'Einstellungen automatisch laden',
- autoConfigLabelText: 'Automatische Einstellung',
- configWizardText: 'Konfigurations-Assistenten starten',
- configWizardLabelText: 'Konfigurations-Assistent',
-
- // helpText
- hgBinaryHelpText: 'Pfad zum "hg" Befehl.',
- pythonBinaryHelpText: 'Pfad zum "python" Befehl.',
- pythonPathHelpText: 'Python Modul Suchpfad (PYTHONPATH).',
- repositoryDirectoryHelpText: 'Verzeichnis der Mercurial-Repositories.',
- useOptimizedBytecodeHelpText: 'Optimierten Bytecode verwenden (python -O).'
-
- });
-
-}
-
-// register information panel
-
-initCallbacks.push(function(main){
- main.registerInfoPanel('hg', {
- checkoutTemplate: 'hg clone {0}',
- xtype: 'repositoryExtendedInfoPanel'
- });
-});
-
-// register config panel
-
-registerConfigPanel({
- id: 'hgConfigForm',
- xtype : 'hgConfigPanel'
-});
diff --git a/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hgbrowse.py b/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hgbrowse.py
deleted file mode 100644
index c6b99ea826..0000000000
--- a/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hgbrowse.py
+++ /dev/null
@@ -1,82 +0,0 @@
-import os
-
-pythonPath = os.environ['SCM_PYTHON_PATH']
-
-if len(pythonPath) > 0:
- pathParts = pythonPath.split(os.pathsep)
- for i in range(len(pathParts)):
- sys.path.insert(i, pathParts[i])
-
-
-from mercurial import hg, ui
-import datetime, time
-
-def getName(path):
- parts = path.split('/')
- length = len(parts)
- if path.endswith('/'):
- length =- 1
- return parts[length - 1]
-
-repositoryPath = os.environ['SCM_REPOSITORY_PATH']
-
-revision = os.environ['SCM_REVISION']
-path = os.environ['SCM_PATH']
-name = getName(path)
-length = 0
-paths = []
-repo = hg.repository(ui.ui(), path = repositoryPath)
-mf = repo[revision].manifest()
-
-if path is "":
- length = 1
- for f in mf:
- paths.append(f)
-else:
- length = len(path.split('/')) + 1
- for f in mf:
- if f.startswith(path):
- paths.append(f)
-
-files = []
-directories = []
-
-for p in paths:
- parts = p.split('/')
- depth = len(parts)
- if depth is length:
- file = repo[revision][p]
- files.append(file)
- elif depth > length:
- dirpath = ''
- for i in range(0, length):
- dirpath += parts[i] + '/'
- if not dirpath in directories:
- directories.append(dirpath)
-
-print ''
-print ''
-print ' ' + revision + ''
-# todo print tag, and branch
-print ' '
-for dir in directories:
- print ' '
- print ' ' + getName(dir) + ''
- print ' ' + dir + ''
- print ' true'
- print ' '
-
-for file in files:
- linkrev = repo[file.linkrev()]
- time = int(linkrev.date()[0]) * 1000
- desc = linkrev.description()
- print ' '
- print ' ' + getName(file.path()) + ''
- print ' ' + file.path() + ''
- print ' false'
- print ' ' + str(file.size()) + ''
- print ' ' + str(time).split('.')[0] + ''
- print ' ' + desc + ''
- print ' '
-print ' '
-print ''
diff --git a/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hgweb.py b/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hgweb.py
deleted file mode 100644
index 9dce2b4f7b..0000000000
--- a/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hgweb.py
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env ${python}
-
-import os, sys
-pythonPath = os.environ['SCM_PYTHON_PATH']
-
-if len(pythonPath) > 0:
- pathParts = pythonPath.split(os.pathsep)
- for i in range(len(pathParts)):
- sys.path.insert(i, pathParts[i])
-
-repositoryPath = os.environ['SCM_REPOSITORY_PATH']
-
-from mercurial import demandimport; demandimport.enable()
-from mercurial.hgweb import hgweb, wsgicgi
-application = hgweb(repositoryPath)
-wsgicgi.launch(application)
diff --git a/plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/HgRepositoryHandlerTest.java b/plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/HgRepositoryHandlerTest.java
deleted file mode 100644
index 3f265d7635..0000000000
--- a/plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/HgRepositoryHandlerTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * Copyright (c) 2010, Sebastian Sdorra
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of SCM-Manager; nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://bitbucket.org/sdorra/scm-manager
- *
- */
-
-
-
-package sonia.scm.repository;
-
-//~--- non-JDK imports --------------------------------------------------------
-
-import sonia.scm.io.DefaultFileSystem;
-import sonia.scm.store.StoreFactory;
-
-import static org.junit.Assert.*;
-import static org.junit.Assume.*;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.io.File;
-
-/**
- *
- * @author Sebastian Sdorra
- */
-public class HgRepositoryHandlerTest extends SimpleRepositoryHandlerTestBase
-{
-
- /**
- * Method description
- *
- *
- * @param directory
- */
- @Override
- protected void checkDirectory(File directory)
- {
- File hgDirectory = new File(directory, ".hg");
-
- assertTrue(hgDirectory.exists());
- assertTrue(hgDirectory.isDirectory());
-
- File hgrc = new File(hgDirectory, "hgrc");
-
- assertTrue(hgrc.exists());
- assertTrue(hgrc.isFile());
- assertTrue(hgrc.length() > 0);
- }
-
- /**
- * Method description
- *
- *
- * @param factory
- * @param directory
- *
- * @return
- */
- @Override
- protected RepositoryHandler createRepositoryHandler(StoreFactory factory,
- File directory)
- {
- HgRepositoryHandler handler = new HgRepositoryHandler(factory,
- new DefaultFileSystem());
-
- handler.init(contextProvider);
- handler.getConfig().setRepositoryDirectory(directory);
-
- // skip tests if hg not in path
- if (! handler.isConfigured())
- {
- System.out.println("WARNING could not find hg, skipping test");
- assumeTrue(false);
- }
-
- return handler;
- }
-}