Some more files from the initial work
This commit is contained in:
parent
9fd4334dec
commit
18ba8d0ac5
@ -38,6 +38,7 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form
|
|||||||
'git' => __('git'),
|
'git' => __('git'),
|
||||||
'svn' => __('Subversion'),
|
'svn' => __('Subversion'),
|
||||||
'mercurial' => __('mercurial'),
|
'mercurial' => __('mercurial'),
|
||||||
|
'mtn' => __('monotone'),
|
||||||
);
|
);
|
||||||
foreach (Pluf::f('allowed_scm', array()) as $key => $class) {
|
foreach (Pluf::f('allowed_scm', array()) as $key => $class) {
|
||||||
$choices[$options[$key]] = $key;
|
$choices[$options[$key]] = $key;
|
||||||
@ -92,6 +93,14 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form
|
|||||||
'widget' => 'Pluf_Form_Widget_PasswordInput',
|
'widget' => 'Pluf_Form_Widget_PasswordInput',
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->fields['mtn_master_branch'] = new Pluf_Form_Field_Varchar(
|
||||||
|
array('required' => false,
|
||||||
|
'label' => __('Master branch'),
|
||||||
|
'initial' => '',
|
||||||
|
'widget' => 'Pluf_Form_Widget_Input',
|
||||||
|
'help_text' => __('This should be a world-wide unique identifier for your project. A reverse DNS notation like "com.my-domain.my-project" is a good idea.'),
|
||||||
|
));
|
||||||
|
|
||||||
$this->fields['owners'] = new Pluf_Form_Field_Varchar(
|
$this->fields['owners'] = new Pluf_Form_Field_Varchar(
|
||||||
array('required' => false,
|
array('required' => false,
|
||||||
'label' => __('Project owners'),
|
'label' => __('Project owners'),
|
||||||
@ -156,6 +165,21 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form
|
|||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function clean_mtn_master_branch()
|
||||||
|
{
|
||||||
|
$mtn_master_branch = mb_strtolower($this->cleaned_data['mtn_master_branch']);
|
||||||
|
if (!preg_match('/^([\w\d]+([-][\w\d]+)*)(\.[\w\d]+([-][\w\d]+)*)*$/', $mtn_master_branch)) {
|
||||||
|
throw new Pluf_Form_Invalid(__('This master branch contains illegal characters, please use only letters, digits, dashs and dots as separators.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = new Pluf_SQL('vkey=%s AND vdesc=%s', array("mtn_master_branch", $mtn_master_branch));
|
||||||
|
$l = Pluf::factory('IDF_Conf')->getList(array('filter'=>$sql->gen()));
|
||||||
|
if ($l->count() > 0) {
|
||||||
|
throw new Pluf_Form_Invalid(__('This master branch is already used. Please select another one.'));
|
||||||
|
}
|
||||||
|
return $mtn_master_branch;
|
||||||
|
}
|
||||||
|
|
||||||
public function clean_shortname()
|
public function clean_shortname()
|
||||||
{
|
{
|
||||||
$shortname = mb_strtolower($this->cleaned_data['shortname']);
|
$shortname = mb_strtolower($this->cleaned_data['shortname']);
|
||||||
@ -184,6 +208,11 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form
|
|||||||
$this->cleaned_data[$key] = '';
|
$this->cleaned_data[$key] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->cleaned_data['scm'] != 'mtn') {
|
||||||
|
$this->cleaned_data['mtn_master_branch'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [signal]
|
* [signal]
|
||||||
*
|
*
|
||||||
@ -222,8 +251,8 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form
|
|||||||
$project->create();
|
$project->create();
|
||||||
$conf = new IDF_Conf();
|
$conf = new IDF_Conf();
|
||||||
$conf->setProject($project);
|
$conf->setProject($project);
|
||||||
$keys = array('scm', 'svn_remote_url',
|
$keys = array('scm', 'svn_remote_url', 'svn_username',
|
||||||
'svn_username', 'svn_password');
|
'svn_password', 'mtn_master_branch');
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
$this->cleaned_data[$key] = (!empty($this->cleaned_data[$key])) ?
|
$this->cleaned_data[$key] = (!empty($this->cleaned_data[$key])) ?
|
||||||
$this->cleaned_data[$key] : '';
|
$this->cleaned_data[$key] : '';
|
||||||
|
@ -435,7 +435,8 @@ class IDF_Project extends Pluf_Model
|
|||||||
$roots = array(
|
$roots = array(
|
||||||
'git' => 'master',
|
'git' => 'master',
|
||||||
'svn' => 'HEAD',
|
'svn' => 'HEAD',
|
||||||
'mercurial' => 'tip'
|
'mercurial' => 'tip',
|
||||||
|
'mtn' => 'h:',
|
||||||
);
|
);
|
||||||
$scm = $conf->getVal('scm', 'git');
|
$scm = $conf->getVal('scm', 'git');
|
||||||
return $roots[$scm];
|
return $roots[$scm];
|
||||||
|
@ -519,6 +519,7 @@ class IDF_Views_Project
|
|||||||
'git' => __('git'),
|
'git' => __('git'),
|
||||||
'svn' => __('Subversion'),
|
'svn' => __('Subversion'),
|
||||||
'mercurial' => __('mercurial'),
|
'mercurial' => __('mercurial'),
|
||||||
|
'mtn' => __('monotone'),
|
||||||
);
|
);
|
||||||
$repository_type = $options[$scm];
|
$repository_type = $options[$scm];
|
||||||
return Pluf_Shortcuts_RenderToResponse('idf/admin/source.html',
|
return Pluf_Shortcuts_RenderToResponse('idf/admin/source.html',
|
||||||
|
@ -73,6 +73,12 @@ $cfg['git_write_remote_url'] = 'git@localhost:%s.git';
|
|||||||
$cfg['svn_repositories'] = 'file:///home/svn/repositories/%s';
|
$cfg['svn_repositories'] = 'file:///home/svn/repositories/%s';
|
||||||
$cfg['svn_remote_url'] = 'http://localhost/svn/%s';
|
$cfg['svn_remote_url'] = 'http://localhost/svn/%s';
|
||||||
|
|
||||||
|
# Same as for git, you can have multiple repositories, one for each
|
||||||
|
# project or a single one for all the projects.
|
||||||
|
$cfg['mtn_repositories'] = '/home/mtn/repositories/%s.mtn';
|
||||||
|
$cfg['mtn_branch_prefix'] = 'com.indefero.projects.';
|
||||||
|
$cfg['mtn_remote_url'] = 'mtn://localhost/~%s/%s%s';
|
||||||
|
|
||||||
# Mercurial repositories path
|
# Mercurial repositories path
|
||||||
#$cfg['mercurial_repositories'] = '/home/mercurial/repositories/%s';
|
#$cfg['mercurial_repositories'] = '/home/mercurial/repositories/%s';
|
||||||
#$cfg['mercurial_remote_url'] = 'http://projects.ceondo.com/hg/%s';
|
#$cfg['mercurial_remote_url'] = 'http://projects.ceondo.com/hg/%s';
|
||||||
@ -209,6 +215,7 @@ $cfg['languages'] = array('en', 'fr');
|
|||||||
$cfg['allowed_scm'] = array('git' => 'IDF_Scm_Git',
|
$cfg['allowed_scm'] = array('git' => 'IDF_Scm_Git',
|
||||||
'svn' => 'IDF_Scm_Svn',
|
'svn' => 'IDF_Scm_Svn',
|
||||||
'mercurial' => 'IDF_Scm_Mercurial',
|
'mercurial' => 'IDF_Scm_Mercurial',
|
||||||
|
'mtn' => 'IDF_Scm_Monotone',
|
||||||
);
|
);
|
||||||
|
|
||||||
# If you want to use another memtypes database
|
# If you want to use another memtypes database
|
||||||
|
@ -52,6 +52,13 @@
|
|||||||
{$form.f.svn_password|unsafe}
|
{$form.f.svn_password|unsafe}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="mtn-form">
|
||||||
|
<th>{$form.f.mtn_master_branch.labelTag}:</th>
|
||||||
|
<td>{if $form.f.mtn_master_branch.errors}{$form.f.mtn_master_branch.fieldErrors}{/if}
|
||||||
|
{$form.f.mtn_master_branch|unsafe}<br />
|
||||||
|
<span class="helptext">{$form.f.mtn_master_branch.help_text}</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th><strong>{$form.f.owners.labelTag}:</strong></th>
|
<th><strong>{$form.f.owners.labelTag}:</strong></th>
|
||||||
<td>
|
<td>
|
||||||
@ -112,12 +119,22 @@ $(document).ready(function() {
|
|||||||
if ($("#id_scm option:selected").val() != "svn") {
|
if ($("#id_scm option:selected").val() != "svn") {
|
||||||
$(".svn-form").hide();
|
$(".svn-form").hide();
|
||||||
}
|
}
|
||||||
|
// Hide if not mtn
|
||||||
|
if ($("#id_scm option:selected").val() != "mtn") {
|
||||||
|
$(".mtn-form").hide();
|
||||||
|
}
|
||||||
$("#id_scm").change(function () {
|
$("#id_scm").change(function () {
|
||||||
if ($("#id_scm option:selected").val() == "svn") {
|
if ($("#id_scm option:selected").val() == "svn") {
|
||||||
$(".svn-form").show();
|
$(".svn-form").show();
|
||||||
} else {
|
} else {
|
||||||
$(".svn-form").hide();
|
$(".svn-form").hide();
|
||||||
}
|
}
|
||||||
|
if ($("#id_scm option:selected").val() == "mtn") {
|
||||||
|
$(".mtn-form").show();
|
||||||
|
} else {
|
||||||
|
$(".mtn-form").hide();
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -3,15 +3,12 @@
|
|||||||
{block body}
|
{block body}
|
||||||
|
|
||||||
<p>{blocktrans}The team behind {$project} is using
|
<p>{blocktrans}The team behind {$project} is using
|
||||||
the <strong>git</strong> software to manage the source
|
the <strong>monotone</strong> software to manage the source
|
||||||
code.{/blocktrans}</p>
|
code.{/blocktrans}</p>
|
||||||
|
|
||||||
<h3>{trans 'Command-Line Access'}</h3>
|
<h3>{trans 'Command-Line Access'}</h3>
|
||||||
|
|
||||||
<p><kbd>git clone {$project.getSourceAccessUrl($user)}</kbd></p>
|
<p><kbd>mtn clone {$project.getSourceAccessUrl()}</kbd></p>
|
||||||
|
|
||||||
{aurl 'url', 'IDF_Views_User::myAccount'}
|
|
||||||
<p>{blocktrans}You may need to <a href="{$url}">provide your SSH key</a>. The synchronization of your SSH key can take a couple of minutes. You can learn more about <a href="http://www.google.com/search?q=public+ssh+key+authentication">SSH key authentification</a>.{/blocktrans}</p>
|
|
||||||
|
|
||||||
{if $isOwner or $isMember}
|
{if $isOwner or $isMember}
|
||||||
<h3>{trans 'First Commit'}</h3>
|
<h3>{trans 'First Commit'}</h3>
|
||||||
@ -19,11 +16,9 @@ code.{/blocktrans}</p>
|
|||||||
<p>{blocktrans}To make a first commit in the repository, perform the following steps:{/blocktrans}</p>
|
<p>{blocktrans}To make a first commit in the repository, perform the following steps:{/blocktrans}</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
git init
|
mtn add -R .
|
||||||
git add .
|
mtn commit -m "initial import"
|
||||||
git commit -m "initial import"
|
mtn push {$project.getSourceAccessUrl()}
|
||||||
git remote add origin {$project.getWriteRemoteAccessUrl($url)}
|
|
||||||
git push origin master
|
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
|
Loading…
Reference in New Issue
Block a user