Changeset - 221d6a002601
[Not reviewed]
default
0 4 0
Mads Kiilerich - 10 years ago 2015-06-09 22:53:24
madski@unity3d.com
repos: cleanup of stuff related to clone_uri
4 files changed with 8 insertions and 27 deletions:
0 comments (0 inline, 0 general)
kallithea/model/validators.py
Show inline comments
 
@@ -468,15 +468,15 @@ def ValidCloneUri():
 
                raise NotImplementedError()
 
            else:
 
                raise Exception('clone from URI %s not allowed' % (url))
 

	
 
    class _validator(formencode.validators.FancyValidator):
 
        messages = {
 
            'clone_uri': _(u'invalid clone URL'),
 
            'invalid_clone_uri': _(u'Invalid clone URL, provide a '
 
                                    'valid clone http(s)/svn+http(s)/ssh URL')
 
            'clone_uri': _(u'Invalid repository URL'),
 
            'invalid_clone_uri': _(u'Invalid repository URL. It must be a '
 
                                    'valid http, https, ssh, svn+http or svn+https URL'),
 
        }
 

	
 
        def validate_python(self, value, state):
 
            repo_type = value.get('repo_type')
 
            url = value.get('clone_uri')
 

	
kallithea/templates/admin/repos/repo_add_base.html
Show inline comments
 
@@ -7,24 +7,15 @@ ${h.form(url('repos'))}
 
        <div class="field">
 
            <div class="label">
 
                <label for="repo_name">${_('Name')}:</label>
 
            </div>
 
            <div class="input">
 
                ${h.text('repo_name',class_="small")}
 
                <div style="margin: 6px 0px 0px 0px">
 
                    <a id="remote_clone_toggle" href="#">
 
                        <i class="icon-download-cloud"></i>
 
                        ${_('Import existing repository ?')}
 
                    </a>
 
                </div>
 
                %if not c.authuser.is_admin:
 
                    ${h.hidden('user_created',True)}
 
                %endif
 
            </div>
 
         </div>
 
        <div id="remote_clone" class="field" style="display: none">
 
        <div id="remote_clone" class="field">
 
            <div class="label">
 
                <label for="clone_uri">${_('Clone from')}:</label>
 
            </div>
 
            <div class="input">
 
                ${h.text('clone_uri',class_="small")}
 
                <span class="help-block">
 
@@ -99,22 +90,12 @@ ${h.form(url('repos'))}
 
            }
 
            else{
 
                $('#copy_perms').hide();
 
            }
 
        }
 

	
 
        $('#remote_clone_toggle').on('click', function(e){
 
            $('#remote_clone').show();
 
            e.preventDefault();
 
        });
 
        if($('#remote_clone input').hasClass('error')){
 
            $('#remote_clone').show();
 
        }
 
        if($('#remote_clone input').val()){
 
            $('#remote_clone').show();
 
        }
 
        $("#repo_group").select2({
 
            'dropdownAutoWidth': true
 
        });
 

	
 
        setCopyPermsOption($('#repo_group').val());
 
        $("#repo_group").on("change", function(e) {
kallithea/templates/admin/repos/repo_edit_settings.html
Show inline comments
 
@@ -24,13 +24,13 @@ ${h.form(url('repo', repo_name=c.repo_in
 
                  %if c.repo_info.clone_uri:
 
                    <div id="clone_uri_hidden" style="font-size: 14px">
 
                        <span id="clone_uri_hidden_value">${c.repo_info.clone_uri_hidden}</span>
 
                        <span style="cursor: pointer; padding: 0px 0px 5px 0px" id="edit_clone_uri"><i class="icon-edit"></i>${_('Edit')}</span>
 
                    </div>
 
                    <div id="alter_clone_uri" style="display: none">
 
                        ${h.text('clone_uri',class_="medium",  placeholder=_('new value'))}
 
                        ${h.text('clone_uri',class_="medium", placeholder=_('New URL'))}
 
                    </div>
 
                  %else:
 
                    ## not set yet, display form to set it
 
                    ${h.text('clone_uri',class_="medium")}
 
                    ${h.hidden('clone_uri_change', 'NEW')}
 
                  %endif
 
@@ -148,13 +148,13 @@ ${h.form(url('repo', repo_name=c.repo_in
 
        });
 
        $('#edit_clone_uri').on('click', function(e){
 
          $('#alter_clone_uri').show();
 
          $('#edit_clone_uri').hide();
 
          $('#clone_uri_hidden').hide();
 
          ## store hash of old value for change detection
 
          var uri_change =  '<input id="clone_uri_change" name="clone_uri_change" type="hidden" value="${h.md5(c.repo_info.clone_uri or "").hexdigest()}" />';
 
          var uri_change = '<input id="clone_uri_change" name="clone_uri_change" type="hidden" value="${h.md5(c.repo_info.clone_uri or "").hexdigest()}" />';
 
          $('#alter_clone_uri_help_block').html($('#alter_clone_uri_help_block').html()+" ("+$('#clone_uri_hidden_value').html()+")");
 
        });
 

	
 
        $('#repo_landing_rev').select2({
 
            'dropdownAutoWidth': true
 
        });
kallithea/tests/functional/test_admin_repos.py
Show inline comments
 
@@ -345,13 +345,13 @@ class _BaseTest(object):
 
                        fixture._get_repo_create_params(repo_private=False,
 
                                                repo_name=repo_name,
 
                                                repo_type=self.REPO_TYPE,
 
                                                repo_description=description,
 
                                                clone_uri='http://127.0.0.1/repo',
 
                                                _authentication_token=self.authentication_token()))
 
        response.mustcontain('invalid clone URL')
 
        response.mustcontain('Invalid repository URL')
 

	
 

	
 
    def test_create_remote_repo_wrong_clone_uri_hg_svn(self):
 
        self.log_user()
 
        repo_name = self.NEW_REPO
 
        description = 'description for newly created repo'
 
@@ -359,13 +359,13 @@ class _BaseTest(object):
 
                        fixture._get_repo_create_params(repo_private=False,
 
                                                repo_name=repo_name,
 
                                                repo_type=self.REPO_TYPE,
 
                                                repo_description=description,
 
                                                clone_uri='svn+http://127.0.0.1/repo',
 
                                                _authentication_token=self.authentication_token()))
 
        response.mustcontain('invalid clone URL')
 
        response.mustcontain('Invalid repository URL')
 

	
 

	
 
    def test_delete(self):
 
        self.log_user()
 
        repo_name = 'vcs_test_new_to_delete_%s' % self.REPO_TYPE
 
        description = 'description for newly created repo'
0 comments (0 inline, 0 general)