files: added updated new repo instructions.

This commit is contained in:
Marcin Kuzminski 2019-07-01 11:59:20 +02:00
parent 1d2ea09125
commit 45a4a60cb7
2 changed files with 36 additions and 18 deletions

View file

@ -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.

View file

@ -124,28 +124,44 @@ ${c.repo_commits.pager('$link_previous ~2~ $link_next')}
%endif
</div>
%if not h.is_svn(c.rhodecode_repo):
<div class="fieldset">
<p><b>${_('Push new repo:')}</b></p>
<pre>
${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
<div class="fieldset">
<p><b>${_('Push new repo:')}</b></p>
<pre>
%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
</pre>
</div>
</div>
<div class="fieldset">
<p><b>${_('Existing repository?')}</b></p>
<pre>
%if h.is_git(c.rhodecode_repo):
<div class="fieldset">
<p><b>${_('Existing repository?')}</b></p>
<pre>
%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
</pre>
</div>
%endif
</div>
</div>
%endif