forks: fixed forking with new landing rev.

- also fix tests for that
This commit is contained in:
Marcin Kuzminski 2019-10-03 09:34:02 +02:00
parent e9018c74bd
commit 340b56f1fa
3 changed files with 7 additions and 9 deletions

View file

@ -130,7 +130,6 @@ class TestRepoForkViewTests(TestController):
'repo_type': backend.alias,
'description': description,
'private': 'False',
'landing_rev': 'rev:tip',
'csrf_token': csrf_token,
}
@ -159,7 +158,6 @@ class TestRepoForkViewTests(TestController):
'repo_type': backend.alias,
'description': description,
'private': 'False',
'landing_rev': 'rev:tip',
'csrf_token': csrf_token,
}
self.app.post(
@ -172,8 +170,8 @@ class TestRepoForkViewTests(TestController):
route_path('repo_creating_check', repo_name=fork_name))
# test if we have a message that fork is ok
assert_session_flash(response,
'Forked repository %s as <a href="/%s">%s</a>'
% (repo_name, fork_name, fork_name))
'Forked repository %s as <a href="/%s">%s</a>' % (
repo_name, fork_name, fork_name))
# test if the fork was created in the database
fork_repo = Session().query(Repository)\
@ -205,7 +203,6 @@ class TestRepoForkViewTests(TestController):
'repo_type': backend.alias,
'description': description,
'private': 'False',
'landing_rev': 'rev:tip',
'csrf_token': csrf_token,
}
self.app.post(
@ -218,8 +215,8 @@ class TestRepoForkViewTests(TestController):
route_path('repo_creating_check', repo_name=fork_name_full))
# test if we have a message that fork is ok
assert_session_flash(response,
'Forked repository %s as <a href="/%s">%s</a>'
% (repo_name, fork_name_full, fork_name_full))
'Forked repository %s as <a href="/%s">%s</a>' % (
repo_name, fork_name_full, fork_name_full))
# test if the fork was created in the database
fork_repo = Session().query(Repository)\

View file

@ -218,6 +218,7 @@ class RepoForksView(RepoAppView, DataGridAppView):
# forbid injecting other repo by forging a request
post_data['fork_parent_id'] = self.db_repo.repo_id
post_data['landing_rev'] = self.db_repo._landing_revision
form_result = {}
task_id = None

View file

@ -239,7 +239,7 @@ def create_repo_fork(form_data, cur_user):
private = form_data['private']
clone_uri = form_data.get('clone_uri')
repo_group = safe_int(form_data['repo_group'])
landing_rev = form_data['landing_rev']
landing_ref = form_data['landing_rev']
copy_fork_permissions = form_data.get('copy_permissions')
fork_id = safe_int(form_data.get('fork_parent_id'))
@ -253,7 +253,7 @@ def create_repo_fork(form_data, cur_user):
private=private,
clone_uri=clone_uri,
repo_group=repo_group,
landing_rev=landing_rev,
landing_rev=landing_ref,
fork_of=fork_of,
copy_fork_permissions=copy_fork_permissions
)