# HG changeset patch # User Marcin Kuzminski # Date 2019-10-03 07:34:02 # Node ID f86c0abcf44393b371ca2fbe0efb35eb1932c23f # Parent 2ec277c208c9f147c32d9753f23f86528189212d forks: fixed forking with new landing rev. - also fix tests for that diff --git a/rhodecode/apps/repository/tests/test_repo_forks.py b/rhodecode/apps/repository/tests/test_repo_forks.py --- a/rhodecode/apps/repository/tests/test_repo_forks.py +++ b/rhodecode/apps/repository/tests/test_repo_forks.py @@ -130,7 +130,6 @@ class TestRepoForkViewTests(TestControll 'repo_type': backend.alias, 'description': description, 'private': 'False', - 'landing_rev': 'rev:tip', 'csrf_token': csrf_token, } @@ -159,7 +158,6 @@ class TestRepoForkViewTests(TestControll '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(TestControll 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 %s' - % (repo_name, fork_name, fork_name)) + 'Forked repository %s as %s' % ( + 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(TestControll '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(TestControll 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 %s' - % (repo_name, fork_name_full, fork_name_full)) + 'Forked repository %s as %s' % ( + repo_name, fork_name_full, fork_name_full)) # test if the fork was created in the database fork_repo = Session().query(Repository)\ diff --git a/rhodecode/apps/repository/views/repo_forks.py b/rhodecode/apps/repository/views/repo_forks.py --- a/rhodecode/apps/repository/views/repo_forks.py +++ b/rhodecode/apps/repository/views/repo_forks.py @@ -218,6 +218,7 @@ class RepoForksView(RepoAppView, DataGri # 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 diff --git a/rhodecode/lib/celerylib/tasks.py b/rhodecode/lib/celerylib/tasks.py --- a/rhodecode/lib/celerylib/tasks.py +++ b/rhodecode/lib/celerylib/tasks.py @@ -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 )