Changeset - 6c88624c719b
[Not reviewed]
beta
0 2 0
Mads Kiilerich - 13 years ago 2013-03-20 15:00:31
madski@unity3d.com
Transplanted from: 63391519ca46
fork: 'Update after clone' only makes sense if the update hook will maintain it
2 files changed with 11 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/forks.py
Show inline comments
 
@@ -35,13 +35,14 @@ import rhodecode.lib.helpers as h
 

	
 
from rhodecode.lib.helpers import Page
 
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator, \
 
    NotAnonymous, HasRepoPermissionAny, HasPermissionAllDecorator,\
 
    HasPermissionAnyDecorator
 
from rhodecode.lib.base import BaseRepoController, render
 
from rhodecode.model.db import Repository, RepoGroup, UserFollowing, User
 
from rhodecode.model.db import Repository, RepoGroup, UserFollowing, User,\
 
    RhodeCodeUi
 
from rhodecode.model.repo import RepoModel
 
from rhodecode.model.forms import RepoForkForm
 
from rhodecode.model.scm import ScmModel, GroupList
 
from rhodecode.lib.utils2 import safe_int
 

	
 
log = logging.getLogger(__name__)
 
@@ -92,12 +93,14 @@ class ForksController(BaseRepoController
 
        if last_rev == 0 or c.repo_last_rev == 0:
 
            c.stats_percentage = 0
 
        else:
 
            c.stats_percentage = '%.2f' % ((float((last_rev)) /
 
                                            c.repo_last_rev) * 100)
 

	
 
        c.can_update = RhodeCodeUi.get_by_key(RhodeCodeUi.HOOK_UPDATE).ui_active
 

	
 
        defaults = RepoModel()._get_defaults(repo_name)
 
        # alter the description to indicate a fork
 
        defaults['description'] = ('fork of repository: %s \n%s'
 
                                   % (defaults['repo_name'],
 
                                      defaults['description']))
 
        # add suffix to fork
 
@@ -156,12 +159,16 @@ class ForksController(BaseRepoController
 
                             repo_groups=c.repo_groups_choices,
 
                             landing_revs=c.landing_revs_choices)()
 
        form_result = {}
 
        try:
 
            form_result = _form.to_python(dict(request.POST))
 

	
 
            # an approximation that is better than nothing
 
            if not RhodeCodeUi.get_by_key(RhodeCodeUi.HOOK_UPDATE).ui_active:
 
                form_result['update_after_clone'] = False
 

	
 
            # create fork is done sometimes async on celery, db transaction
 
            # management is handled there.
 
            RepoModel().create_fork(form_result, self.rhodecode_user.user_id)
 
            fork_url = h.link_to(form_result['repo_name_full'],
 
                    h.url('summary_home', repo_name=form_result['repo_name_full']))
 

	
rhodecode/templates/forks/fork.html
Show inline comments
 
@@ -77,22 +77,24 @@
 
                    <label for="private">${_('Copy permissions')}:</label>
 
                </div>
 
                <div class="checkboxes">
 
                    ${h.checkbox('copy_permissions',value="True", checked="checked")}
 
                    <span class="help-block">${_('Copy permissions from forked repository')}</span>
 
                </div>
 
             </div>
 
            </div>
 
            %if c.can_update:
 
            <div class="field">
 
                <div class="label label-checkbox">
 
                    <label for="private">${_('Update after clone')}:</label>
 
                </div>
 
                <div class="checkboxes">
 
                    ${h.checkbox('update_after_clone',value="True")}
 
                    <span class="help-block">${_('Checkout source after making a clone')}</span>
 
                </div>
 
            </div>
 
            %endif
 
            <div class="buttons">
 
                ${h.submit('',_('Fork this repository'),class_="ui-btn large")}
 
            </div>
 
        </div>
 
    </div>
 
    ${h.end_form()}
0 comments (0 inline, 0 general)