diff --git a/rhodecode/apps/repository/views/repo_files.py b/rhodecode/apps/repository/views/repo_files.py --- a/rhodecode/apps/repository/views/repo_files.py +++ b/rhodecode/apps/repository/views/repo_files.py @@ -106,7 +106,8 @@ class RepoFilesView(RepoAppView): _ = self.request.translate if not is_head: - message = _('You can only modify files with commit being a valid branch head.') + message = _('Cannot modify file. ' + 'Given commit `{}` is not head of a branch.').format(commit_id) h.flash(message, category='warning') if json_mode: @@ -214,6 +215,7 @@ class RepoFilesView(RepoAppView): def _is_valid_head(self, commit_id, repo): branch_name = sha_commit_id = '' is_head = False + log.debug('Checking if commit_id %s is a head.', commit_id) if h.is_svn(repo) and not repo.is_empty(): # Note: Subversion only has one head. diff --git a/rhodecode/templates/summary/summary_commits.mako b/rhodecode/templates/summary/summary_commits.mako --- a/rhodecode/templates/summary/summary_commits.mako +++ b/rhodecode/templates/summary/summary_commits.mako @@ -124,28 +124,44 @@ %endif - %if not h.is_svn(c.rhodecode_repo): -
${_('Push new repo:')}
--${c.rhodecode_repo.alias} clone ${c.clone_repo_url} -${c.rhodecode_repo.alias} add README # add first file -${c.rhodecode_repo.alias} commit -m "Initial" # commit with message -${c.rhodecode_repo.alias} push ${'origin master' if h.is_git(c.rhodecode_repo) else ''} # push changes back +++${_('Push new repo:')}
++%if h.is_git(c.rhodecode_repo): +git clone ${c.clone_repo_url} +git add README # add first file +git commit -m "Initial commit" # commit with message +git remote add origin ${c.clone_repo_url} +git push -u origin master # push changes back to default master branch +%elif h.is_hg(c.rhodecode_repo): +hg clone ${c.clone_repo_url} +hg add README # add first file +hg commit -m "Initial commit" # commit with message +hg push ${c.clone_repo_url} +%elif h.is_svn(c.rhodecode_repo): +svn co ${c.clone_repo_url} +svn add README # add first file +svn commit -m "Initial commit" +svn commit # send changes back to the server +%endif-
${_('Existing repository?')}
-- %if h.is_git(c.rhodecode_repo): ++- %endif + +${_('Existing repository?')}
++%if h.is_git(c.rhodecode_repo): git remote add origin ${c.clone_repo_url} git push -u origin master - %else: +%elif h.is_hg(c.rhodecode_repo): hg push ${c.clone_repo_url} - %endif +%elif h.is_svn(c.rhodecode_repo): +svn co ${c.clone_repo_url} +%endif-