Some more files from the initial work
This commit is contained in:
		| @@ -38,6 +38,7 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form | ||||
|                          'git' => __('git'), | ||||
|                          'svn' => __('Subversion'), | ||||
|                          'mercurial' => __('mercurial'), | ||||
|                          'mtn' => __('monotone'), | ||||
|                          ); | ||||
|         foreach (Pluf::f('allowed_scm', array()) as $key => $class) { | ||||
|             $choices[$options[$key]] = $key; | ||||
| @@ -92,6 +93,14 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form | ||||
|                           '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( | ||||
|                                       array('required' => false, | ||||
|                                             'label' => __('Project owners'), | ||||
| @@ -156,6 +165,21 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form | ||||
|         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() | ||||
|     { | ||||
|         $shortname = mb_strtolower($this->cleaned_data['shortname']); | ||||
| @@ -184,6 +208,11 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form | ||||
|                 $this->cleaned_data[$key] = ''; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if ($this->cleaned_data['scm'] != 'mtn') { | ||||
|             $this->cleaned_data['mtn_master_branch'] = ''; | ||||
|         } | ||||
|  | ||||
|         /** | ||||
|          * [signal] | ||||
|          * | ||||
| @@ -222,8 +251,8 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form | ||||
|         $project->create(); | ||||
|         $conf = new IDF_Conf(); | ||||
|         $conf->setProject($project); | ||||
|         $keys = array('scm', 'svn_remote_url',  | ||||
|                       'svn_username', 'svn_password'); | ||||
|         $keys = array('scm', 'svn_remote_url', 'svn_username', | ||||
|                       'svn_password', 'mtn_master_branch'); | ||||
|         foreach ($keys as $key) { | ||||
|             $this->cleaned_data[$key] = (!empty($this->cleaned_data[$key])) ? | ||||
|                 $this->cleaned_data[$key] : ''; | ||||
|   | ||||
| @@ -435,7 +435,8 @@ class IDF_Project extends Pluf_Model | ||||
|         $roots = array( | ||||
|                        'git' => 'master', | ||||
|                        'svn' => 'HEAD', | ||||
|                        'mercurial' => 'tip' | ||||
|                        'mercurial' => 'tip', | ||||
|                        'mtn' => 'h:', | ||||
|                        ); | ||||
|         $scm = $conf->getVal('scm', 'git'); | ||||
|         return $roots[$scm]; | ||||
|   | ||||
| @@ -519,6 +519,7 @@ class IDF_Views_Project | ||||
|                          'git' => __('git'), | ||||
|                          'svn' => __('Subversion'), | ||||
|                          'mercurial' => __('mercurial'), | ||||
|                          'mtn' => __('monotone'), | ||||
|                          ); | ||||
|         $repository_type = $options[$scm]; | ||||
|         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_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 | ||||
| #$cfg['mercurial_repositories'] = '/home/mercurial/repositories/%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', | ||||
|                             'svn' => 'IDF_Scm_Svn', | ||||
|                             'mercurial' => 'IDF_Scm_Mercurial', | ||||
|                             'mtn' => 'IDF_Scm_Monotone', | ||||
|                             ); | ||||
|  | ||||
| # If you want to use another memtypes database | ||||
|   | ||||
| @@ -52,6 +52,13 @@ | ||||
| {$form.f.svn_password|unsafe} | ||||
| </td> | ||||
| </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> | ||||
| <th><strong>{$form.f.owners.labelTag}:</strong></th> | ||||
| <td> | ||||
| @@ -112,12 +119,22 @@ $(document).ready(function() { | ||||
|     if ($("#id_scm option:selected").val() != "svn") { | ||||
|         $(".svn-form").hide(); | ||||
|     } | ||||
|     // Hide if not mtn | ||||
|     if ($("#id_scm option:selected").val() != "mtn") { | ||||
|         $(".mtn-form").hide(); | ||||
|     } | ||||
|     $("#id_scm").change(function () { | ||||
|         if ($("#id_scm option:selected").val() == "svn") { | ||||
|             $(".svn-form").show(); | ||||
|         } else { | ||||
|             $(".svn-form").hide(); | ||||
|         } | ||||
|         if ($("#id_scm option:selected").val() == "mtn") { | ||||
|             $(".mtn-form").show(); | ||||
|         } else { | ||||
|             $(".mtn-form").hide(); | ||||
|         } | ||||
|  | ||||
|     }); | ||||
| }); | ||||
| </script> | ||||
|   | ||||
| @@ -3,15 +3,12 @@ | ||||
| {block body} | ||||
|  | ||||
| <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> | ||||
|  | ||||
| <h3>{trans 'Command-Line Access'}</h3> | ||||
|  | ||||
| <p><kbd>git clone {$project.getSourceAccessUrl($user)}</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> | ||||
| <p><kbd>mtn clone {$project.getSourceAccessUrl()}</kbd></p> | ||||
|  | ||||
| {if $isOwner or $isMember} | ||||
| <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> | ||||
|  | ||||
| <pre> | ||||
| git init | ||||
| git add . | ||||
| git commit -m "initial import" | ||||
| git remote add origin {$project.getWriteRemoteAccessUrl($url)} | ||||
| git push origin master | ||||
| mtn add -R . | ||||
| mtn commit -m "initial import" | ||||
| mtn push {$project.getSourceAccessUrl()} | ||||
| </pre> | ||||
|  | ||||
| {/if} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user