Show More
@@ -1,181 +1,181 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """ |
|
2 | """ | |
3 | rhodecode.controllers.compare |
|
3 | rhodecode.controllers.compare | |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | compare controller for pylons showing differences between two |
|
6 | compare controller for pylons showing differences between two | |
7 | repos, branches, bookmarks or tips |
|
7 | repos, branches, bookmarks or tips | |
8 |
|
8 | |||
9 | :created_on: May 6, 2012 |
|
9 | :created_on: May 6, 2012 | |
10 | :author: marcink |
|
10 | :author: marcink | |
11 | :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com> |
|
11 | :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com> | |
12 | :license: GPLv3, see COPYING for more details. |
|
12 | :license: GPLv3, see COPYING for more details. | |
13 | """ |
|
13 | """ | |
14 | # This program is free software: you can redistribute it and/or modify |
|
14 | # This program is free software: you can redistribute it and/or modify | |
15 | # it under the terms of the GNU General Public License as published by |
|
15 | # it under the terms of the GNU General Public License as published by | |
16 | # the Free Software Foundation, either version 3 of the License, or |
|
16 | # the Free Software Foundation, either version 3 of the License, or | |
17 | # (at your option) any later version. |
|
17 | # (at your option) any later version. | |
18 | # |
|
18 | # | |
19 | # This program is distributed in the hope that it will be useful, |
|
19 | # This program is distributed in the hope that it will be useful, | |
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | # GNU General Public License for more details. |
|
22 | # GNU General Public License for more details. | |
23 | # |
|
23 | # | |
24 | # You should have received a copy of the GNU General Public License |
|
24 | # You should have received a copy of the GNU General Public License | |
25 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
25 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
26 | import logging |
|
26 | import logging | |
27 | import traceback |
|
27 | import traceback | |
28 |
|
28 | |||
29 | from webob.exc import HTTPNotFound |
|
29 | from webob.exc import HTTPNotFound | |
30 | from pylons import request, response, session, tmpl_context as c, url |
|
30 | from pylons import request, response, session, tmpl_context as c, url | |
31 | from pylons.controllers.util import abort, redirect |
|
31 | from pylons.controllers.util import abort, redirect | |
32 | from pylons.i18n.translation import _ |
|
32 | from pylons.i18n.translation import _ | |
33 |
|
33 | |||
34 | from rhodecode.lib.vcs.exceptions import EmptyRepositoryError, RepositoryError |
|
34 | from rhodecode.lib.vcs.exceptions import EmptyRepositoryError, RepositoryError | |
35 | from rhodecode.lib import helpers as h |
|
35 | from rhodecode.lib import helpers as h | |
36 | from rhodecode.lib.base import BaseRepoController, render |
|
36 | from rhodecode.lib.base import BaseRepoController, render | |
37 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
|
37 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator | |
38 | from rhodecode.lib import diffs |
|
38 | from rhodecode.lib import diffs | |
39 |
|
39 | |||
40 | from rhodecode.model.db import Repository |
|
40 | from rhodecode.model.db import Repository | |
41 | from rhodecode.model.pull_request import PullRequestModel |
|
41 | from rhodecode.model.pull_request import PullRequestModel | |
42 | from webob.exc import HTTPBadRequest |
|
42 | from webob.exc import HTTPBadRequest | |
43 | from rhodecode.lib.utils2 import str2bool |
|
43 | from rhodecode.lib.utils2 import str2bool | |
44 | from rhodecode.lib.diffs import LimitedDiffContainer |
|
44 | from rhodecode.lib.diffs import LimitedDiffContainer | |
45 | from rhodecode.lib.vcs.backends.base import EmptyChangeset |
|
45 | from rhodecode.lib.vcs.backends.base import EmptyChangeset | |
46 |
|
46 | |||
47 | log = logging.getLogger(__name__) |
|
47 | log = logging.getLogger(__name__) | |
48 |
|
48 | |||
49 |
|
49 | |||
50 | class CompareController(BaseRepoController): |
|
50 | class CompareController(BaseRepoController): | |
51 |
|
51 | |||
52 | @LoginRequired() |
|
52 | @LoginRequired() | |
53 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
|
53 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', | |
54 | 'repository.admin') |
|
54 | 'repository.admin') | |
55 | def __before__(self): |
|
55 | def __before__(self): | |
56 | super(CompareController, self).__before__() |
|
56 | super(CompareController, self).__before__() | |
57 |
|
57 | |||
58 | def __get_cs_or_redirect(self, rev, repo, redirect_after=True, |
|
58 | def __get_cs_or_redirect(self, rev, repo, redirect_after=True, | |
59 | partial=False): |
|
59 | partial=False): | |
60 | """ |
|
60 | """ | |
61 | Safe way to get changeset if error occur it redirects to changeset with |
|
61 | Safe way to get changeset if error occur it redirects to changeset with | |
62 | proper message. If partial is set then don't do redirect raise Exception |
|
62 | proper message. If partial is set then don't do redirect raise Exception | |
63 | instead |
|
63 | instead | |
64 |
|
64 | |||
65 | :param rev: revision to fetch |
|
65 | :param rev: revision to fetch | |
66 | :param repo: repo instance |
|
66 | :param repo: repo instance | |
67 | """ |
|
67 | """ | |
68 |
|
68 | |||
69 | try: |
|
69 | try: | |
70 | type_, rev = rev |
|
70 | type_, rev = rev | |
71 | return repo.scm_instance.get_changeset(rev) |
|
71 | return repo.scm_instance.get_changeset(rev) | |
72 | except EmptyRepositoryError, e: |
|
72 | except EmptyRepositoryError, e: | |
73 | if not redirect_after: |
|
73 | if not redirect_after: | |
74 | return None |
|
74 | return None | |
75 | h.flash(h.literal(_('There are no changesets yet')), |
|
75 | h.flash(h.literal(_('There are no changesets yet')), | |
76 | category='warning') |
|
76 | category='warning') | |
77 | redirect(url('summary_home', repo_name=repo.repo_name)) |
|
77 | redirect(url('summary_home', repo_name=repo.repo_name)) | |
78 |
|
78 | |||
79 | except RepositoryError, e: |
|
79 | except RepositoryError, e: | |
80 | log.error(traceback.format_exc()) |
|
80 | log.error(traceback.format_exc()) | |
81 | h.flash(str(e), category='warning') |
|
81 | h.flash(str(e), category='warning') | |
82 | if not partial: |
|
82 | if not partial: | |
83 | redirect(h.url('summary_home', repo_name=repo.repo_name)) |
|
83 | redirect(h.url('summary_home', repo_name=repo.repo_name)) | |
84 | raise HTTPBadRequest() |
|
84 | raise HTTPBadRequest() | |
85 |
|
85 | |||
86 | def index(self, org_ref_type, org_ref, other_ref_type, other_ref): |
|
86 | def index(self, org_ref_type, org_ref, other_ref_type, other_ref): | |
87 |
|
87 | |||
88 | org_repo = c.rhodecode_db_repo.repo_name |
|
88 | org_repo = c.rhodecode_db_repo.repo_name | |
89 | org_ref = (org_ref_type, org_ref) |
|
89 | org_ref = (org_ref_type, org_ref) | |
90 | other_ref = (other_ref_type, other_ref) |
|
90 | other_ref = (other_ref_type, other_ref) | |
91 | other_repo = request.GET.get('other_repo', org_repo) |
|
91 | other_repo = request.GET.get('other_repo', org_repo) | |
92 | c.fulldiff = fulldiff = request.GET.get('fulldiff') |
|
92 | c.fulldiff = fulldiff = request.GET.get('fulldiff') | |
93 | rev_start = request.GET.get('rev_start') |
|
93 | rev_start = request.GET.get('rev_start') | |
94 | rev_end = request.GET.get('rev_end') |
|
94 | rev_end = request.GET.get('rev_end') | |
95 |
|
95 | |||
96 | c.swap_url = h.url('compare_url', as_form=request.GET.get('as_form'), |
|
96 | c.swap_url = h.url('compare_url', as_form=request.GET.get('as_form'), | |
97 | repo_name=other_repo, |
|
97 | repo_name=other_repo, | |
98 | org_ref_type=other_ref[0], org_ref=other_ref[1], |
|
98 | org_ref_type=other_ref[0], org_ref=other_ref[1], | |
99 | repo=org_repo, |
|
99 | other_repo=org_repo, | |
100 | other_ref_type=org_ref[0], other_ref=org_ref[1]) |
|
100 | other_ref_type=org_ref[0], other_ref=org_ref[1]) | |
101 |
|
101 | |||
102 | c.org_repo = org_repo = Repository.get_by_repo_name(org_repo) |
|
102 | c.org_repo = org_repo = Repository.get_by_repo_name(org_repo) | |
103 | c.other_repo = other_repo = Repository.get_by_repo_name(other_repo) |
|
103 | c.other_repo = other_repo = Repository.get_by_repo_name(other_repo) | |
104 |
|
104 | |||
105 | if c.org_repo is None: |
|
105 | if c.org_repo is None: | |
106 | log.error('Could not find org repo %s' % org_repo) |
|
106 | log.error('Could not find org repo %s' % org_repo) | |
107 | raise HTTPNotFound |
|
107 | raise HTTPNotFound | |
108 | if c.other_repo is None: |
|
108 | if c.other_repo is None: | |
109 | log.error('Could not find other repo %s' % other_repo) |
|
109 | log.error('Could not find other repo %s' % other_repo) | |
110 | raise HTTPNotFound |
|
110 | raise HTTPNotFound | |
111 |
|
111 | |||
112 | if c.org_repo != c.other_repo and h.is_git(c.rhodecode_repo): |
|
112 | if c.org_repo != c.other_repo and h.is_git(c.rhodecode_repo): | |
113 | log.error('compare of two remote repos not available for GIT REPOS') |
|
113 | log.error('compare of two remote repos not available for GIT REPOS') | |
114 | raise HTTPNotFound |
|
114 | raise HTTPNotFound | |
115 |
|
115 | |||
116 | if c.org_repo.scm_instance.alias != c.other_repo.scm_instance.alias: |
|
116 | if c.org_repo.scm_instance.alias != c.other_repo.scm_instance.alias: | |
117 | log.error('compare of two different kind of remote repos not available') |
|
117 | log.error('compare of two different kind of remote repos not available') | |
118 | raise HTTPNotFound |
|
118 | raise HTTPNotFound | |
119 |
|
119 | |||
120 | partial = request.environ.get('HTTP_X_PARTIAL_XHR') |
|
120 | partial = request.environ.get('HTTP_X_PARTIAL_XHR') | |
121 | self.__get_cs_or_redirect(rev=org_ref, repo=org_repo, partial=partial) |
|
121 | self.__get_cs_or_redirect(rev=org_ref, repo=org_repo, partial=partial) | |
122 | self.__get_cs_or_redirect(rev=other_ref, repo=other_repo, partial=partial) |
|
122 | self.__get_cs_or_redirect(rev=other_ref, repo=other_repo, partial=partial) | |
123 |
|
123 | |||
124 | if rev_start and rev_end: |
|
124 | if rev_start and rev_end: | |
125 | #replace our org_ref with given CS |
|
125 | #replace our org_ref with given CS | |
126 | org_ref = ('rev', rev_start) |
|
126 | org_ref = ('rev', rev_start) | |
127 | other_ref = ('rev', rev_end) |
|
127 | other_ref = ('rev', rev_end) | |
128 |
|
128 | |||
129 | c.cs_ranges = PullRequestModel().get_compare_data( |
|
129 | c.cs_ranges = PullRequestModel().get_compare_data( | |
130 | org_repo, org_ref, other_repo, other_ref, |
|
130 | org_repo, org_ref, other_repo, other_ref, | |
131 | ) |
|
131 | ) | |
132 |
|
132 | |||
133 | c.statuses = c.rhodecode_db_repo.statuses([x.raw_id for x in |
|
133 | c.statuses = c.rhodecode_db_repo.statuses([x.raw_id for x in | |
134 | c.cs_ranges]) |
|
134 | c.cs_ranges]) | |
135 | c.target_repo = c.repo_name |
|
135 | c.target_repo = c.repo_name | |
136 | # defines that we need hidden inputs with changesets |
|
136 | # defines that we need hidden inputs with changesets | |
137 | c.as_form = request.GET.get('as_form', False) |
|
137 | c.as_form = request.GET.get('as_form', False) | |
138 | if partial: |
|
138 | if partial: | |
139 | return render('compare/compare_cs.html') |
|
139 | return render('compare/compare_cs.html') | |
140 |
|
140 | |||
141 | c.org_ref = org_ref[1] |
|
141 | c.org_ref = org_ref[1] | |
142 | c.other_ref = other_ref[1] |
|
142 | c.other_ref = other_ref[1] | |
143 |
|
143 | |||
144 | if c.cs_ranges and c.org_repo != c.other_repo: |
|
144 | if c.cs_ranges and c.org_repo != c.other_repo: | |
145 | # case we want a simple diff without incoming changesets, just |
|
145 | # case we want a simple diff without incoming changesets, just | |
146 | # for review purposes. Make the diff on the forked repo, with |
|
146 | # for review purposes. Make the diff on the forked repo, with | |
147 | # revision that is common ancestor |
|
147 | # revision that is common ancestor | |
148 | _org_ref = org_ref |
|
148 | _org_ref = org_ref | |
149 | org_ref = ('rev', getattr(c.cs_ranges[0].parents[0] |
|
149 | org_ref = ('rev', getattr(c.cs_ranges[0].parents[0] | |
150 | if c.cs_ranges[0].parents |
|
150 | if c.cs_ranges[0].parents | |
151 | else EmptyChangeset(), 'raw_id')) |
|
151 | else EmptyChangeset(), 'raw_id')) | |
152 | log.debug('Changed org_ref from %s to %s' % (_org_ref, org_ref)) |
|
152 | log.debug('Changed org_ref from %s to %s' % (_org_ref, org_ref)) | |
153 | other_repo = org_repo |
|
153 | other_repo = org_repo | |
154 |
|
154 | |||
155 | diff_limit = self.cut_off_limit if not fulldiff else None |
|
155 | diff_limit = self.cut_off_limit if not fulldiff else None | |
156 |
|
156 | |||
157 | _diff = diffs.differ(org_repo, org_ref, other_repo, other_ref) |
|
157 | _diff = diffs.differ(org_repo, org_ref, other_repo, other_ref) | |
158 |
|
158 | |||
159 | diff_processor = diffs.DiffProcessor(_diff or '', format='gitdiff', |
|
159 | diff_processor = diffs.DiffProcessor(_diff or '', format='gitdiff', | |
160 | diff_limit=diff_limit) |
|
160 | diff_limit=diff_limit) | |
161 | _parsed = diff_processor.prepare() |
|
161 | _parsed = diff_processor.prepare() | |
162 |
|
162 | |||
163 | c.limited_diff = False |
|
163 | c.limited_diff = False | |
164 | if isinstance(_parsed, LimitedDiffContainer): |
|
164 | if isinstance(_parsed, LimitedDiffContainer): | |
165 | c.limited_diff = True |
|
165 | c.limited_diff = True | |
166 |
|
166 | |||
167 | c.files = [] |
|
167 | c.files = [] | |
168 | c.changes = {} |
|
168 | c.changes = {} | |
169 | c.lines_added = 0 |
|
169 | c.lines_added = 0 | |
170 | c.lines_deleted = 0 |
|
170 | c.lines_deleted = 0 | |
171 | for f in _parsed: |
|
171 | for f in _parsed: | |
172 | st = f['stats'] |
|
172 | st = f['stats'] | |
173 | if st[0] != 'b': |
|
173 | if st[0] != 'b': | |
174 | c.lines_added += st[0] |
|
174 | c.lines_added += st[0] | |
175 | c.lines_deleted += st[1] |
|
175 | c.lines_deleted += st[1] | |
176 | fid = h.FID('', f['filename']) |
|
176 | fid = h.FID('', f['filename']) | |
177 | c.files.append([fid, f['operation'], f['filename'], f['stats']]) |
|
177 | c.files.append([fid, f['operation'], f['filename'], f['stats']]) | |
178 | diff = diff_processor.as_html(enable_comments=False, parsed_lines=[f]) |
|
178 | diff = diff_processor.as_html(enable_comments=False, parsed_lines=[f]) | |
179 | c.changes[fid] = [f['operation'], f['filename'], diff] |
|
179 | c.changes[fid] = [f['operation'], f['filename'], diff] | |
180 |
|
180 | |||
181 | return render('compare/compare_diff.html') |
|
181 | return render('compare/compare_diff.html') |
@@ -1,346 +1,348 b'' | |||||
1 | from rhodecode.tests import * |
|
1 | from rhodecode.tests import * | |
2 | from rhodecode.model.repo import RepoModel |
|
2 | from rhodecode.model.repo import RepoModel | |
3 | from rhodecode.model.meta import Session |
|
3 | from rhodecode.model.meta import Session | |
4 | from rhodecode.model.db import Repository |
|
4 | from rhodecode.model.db import Repository | |
5 | from rhodecode.model.scm import ScmModel |
|
5 | from rhodecode.model.scm import ScmModel | |
6 | from rhodecode.lib.vcs.backends.base import EmptyChangeset |
|
6 | from rhodecode.lib.vcs.backends.base import EmptyChangeset | |
7 |
|
7 | |||
8 |
|
8 | |||
9 | def _fork_repo(fork_name, vcs_type, parent=None): |
|
9 | def _fork_repo(fork_name, vcs_type, parent=None): | |
10 | if vcs_type =='hg': |
|
10 | if vcs_type =='hg': | |
11 | _REPO = HG_REPO |
|
11 | _REPO = HG_REPO | |
12 | elif vcs_type == 'git': |
|
12 | elif vcs_type == 'git': | |
13 | _REPO = GIT_REPO |
|
13 | _REPO = GIT_REPO | |
14 |
|
14 | |||
15 | if parent: |
|
15 | if parent: | |
16 | _REPO = parent |
|
16 | _REPO = parent | |
17 |
|
17 | |||
18 | form_data = dict( |
|
18 | form_data = dict( | |
19 | repo_name=fork_name, |
|
19 | repo_name=fork_name, | |
20 | repo_name_full=fork_name, |
|
20 | repo_name_full=fork_name, | |
21 | repo_group=None, |
|
21 | repo_group=None, | |
22 | repo_type=vcs_type, |
|
22 | repo_type=vcs_type, | |
23 | description='', |
|
23 | description='', | |
24 | private=False, |
|
24 | private=False, | |
25 | copy_permissions=False, |
|
25 | copy_permissions=False, | |
26 | landing_rev='tip', |
|
26 | landing_rev='tip', | |
27 | update_after_clone=False, |
|
27 | update_after_clone=False, | |
28 | fork_parent_id=Repository.get_by_repo_name(_REPO), |
|
28 | fork_parent_id=Repository.get_by_repo_name(_REPO), | |
29 | ) |
|
29 | ) | |
30 | repo = RepoModel().create_fork(form_data, cur_user=TEST_USER_ADMIN_LOGIN) |
|
30 | repo = RepoModel().create_fork(form_data, cur_user=TEST_USER_ADMIN_LOGIN) | |
31 |
|
31 | |||
32 | Session().commit() |
|
32 | Session().commit() | |
33 | return Repository.get_by_repo_name(fork_name) |
|
33 | return Repository.get_by_repo_name(fork_name) | |
34 |
|
34 | |||
35 |
|
35 | |||
36 | def _commit_change(repo, filename, content, message, vcs_type, parent=None, newfile=False): |
|
36 | def _commit_change(repo, filename, content, message, vcs_type, parent=None, newfile=False): | |
37 | repo = Repository.get_by_repo_name(repo) |
|
37 | repo = Repository.get_by_repo_name(repo) | |
38 | _cs = parent |
|
38 | _cs = parent | |
39 | if not parent: |
|
39 | if not parent: | |
40 | _cs = EmptyChangeset(alias=vcs_type) |
|
40 | _cs = EmptyChangeset(alias=vcs_type) | |
41 |
|
41 | |||
42 | if newfile: |
|
42 | if newfile: | |
43 | cs = ScmModel().create_node( |
|
43 | cs = ScmModel().create_node( | |
44 | repo=repo.scm_instance, repo_name=repo.repo_name, |
|
44 | repo=repo.scm_instance, repo_name=repo.repo_name, | |
45 | cs=_cs, user=TEST_USER_ADMIN_LOGIN, |
|
45 | cs=_cs, user=TEST_USER_ADMIN_LOGIN, | |
46 | author=TEST_USER_ADMIN_LOGIN, |
|
46 | author=TEST_USER_ADMIN_LOGIN, | |
47 | message=message, |
|
47 | message=message, | |
48 | content=content, |
|
48 | content=content, | |
49 | f_path=filename |
|
49 | f_path=filename | |
50 | ) |
|
50 | ) | |
51 | else: |
|
51 | else: | |
52 | cs = ScmModel().commit_change( |
|
52 | cs = ScmModel().commit_change( | |
53 | repo=repo.scm_instance, repo_name=repo.repo_name, |
|
53 | repo=repo.scm_instance, repo_name=repo.repo_name, | |
54 | cs=parent, user=TEST_USER_ADMIN_LOGIN, |
|
54 | cs=parent, user=TEST_USER_ADMIN_LOGIN, | |
55 | author=TEST_USER_ADMIN_LOGIN, |
|
55 | author=TEST_USER_ADMIN_LOGIN, | |
56 | message=message, |
|
56 | message=message, | |
57 | content=content, |
|
57 | content=content, | |
58 | f_path=filename |
|
58 | f_path=filename | |
59 | ) |
|
59 | ) | |
60 | return cs |
|
60 | return cs | |
61 |
|
61 | |||
62 |
|
62 | |||
63 | class TestCompareController(TestController): |
|
63 | class TestCompareController(TestController): | |
64 |
|
64 | |||
65 | def test_compare_forks_on_branch_extra_commits_hg(self): |
|
65 | def test_compare_forks_on_branch_extra_commits_hg(self): | |
66 | self.log_user() |
|
66 | self.log_user() | |
67 |
|
67 | |||
68 | repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg', |
|
68 | repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg', | |
69 | description='diff-test', |
|
69 | description='diff-test', | |
70 | owner=TEST_USER_ADMIN_LOGIN) |
|
70 | owner=TEST_USER_ADMIN_LOGIN) | |
71 | r1_id = repo1.repo_id |
|
71 | r1_id = repo1.repo_id | |
72 | Session().commit() |
|
72 | Session().commit() | |
73 | #commit something ! |
|
73 | #commit something ! | |
74 | cs0 = _commit_change(repo1.repo_name, filename='file1', content='line1\n', |
|
74 | cs0 = _commit_change(repo1.repo_name, filename='file1', content='line1\n', | |
75 | message='commit1', vcs_type='hg', parent=None, newfile=True) |
|
75 | message='commit1', vcs_type='hg', parent=None, newfile=True) | |
76 |
|
76 | |||
77 | #fork this repo |
|
77 | #fork this repo | |
78 | repo2 = _fork_repo('one-fork', 'hg', parent='one') |
|
78 | repo2 = _fork_repo('one-fork', 'hg', parent='one') | |
79 | Session().commit() |
|
79 | Session().commit() | |
80 | r2_id = repo2.repo_id |
|
80 | r2_id = repo2.repo_id | |
81 |
|
81 | |||
82 | #add two extra commit into fork |
|
82 | #add two extra commit into fork | |
83 | cs1 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\n', |
|
83 | cs1 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\n', | |
84 | message='commit2', vcs_type='hg', parent=cs0) |
|
84 | message='commit2', vcs_type='hg', parent=cs0) | |
85 |
|
85 | |||
86 | cs2 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\nline3\n', |
|
86 | cs2 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\nline3\n', | |
87 | message='commit3', vcs_type='hg', parent=cs1) |
|
87 | message='commit3', vcs_type='hg', parent=cs1) | |
88 |
|
88 | |||
89 | rev1 = 'default' |
|
89 | rev1 = 'default' | |
90 | rev2 = 'default' |
|
90 | rev2 = 'default' | |
91 | response = self.app.get(url(controller='compare', action='index', |
|
91 | response = self.app.get(url(controller='compare', action='index', | |
92 | repo_name=repo2.repo_name, |
|
92 | repo_name=repo2.repo_name, | |
93 | org_ref_type="branch", |
|
93 | org_ref_type="branch", | |
94 | org_ref=rev1, |
|
94 | org_ref=rev1, | |
95 | other_repo=repo1.repo_name, |
|
95 | other_repo=repo1.repo_name, | |
96 | other_ref_type="branch", |
|
96 | other_ref_type="branch", | |
97 | other_ref=rev2, |
|
97 | other_ref=rev2, | |
98 | )) |
|
98 | )) | |
99 |
|
99 | |||
100 | try: |
|
100 | try: | |
101 | response.mustcontain('%s@%s -> %s@%s' % (repo2.repo_name, rev1, repo1.repo_name, rev2)) |
|
101 | response.mustcontain('%s@%s -> %s@%s' % (repo2.repo_name, rev1, repo1.repo_name, rev2)) | |
102 | response.mustcontain("""Showing 2 commits""") |
|
102 | response.mustcontain("""Showing 2 commits""") | |
103 | response.mustcontain("""1 file changed with 2 insertions and 0 deletions""") |
|
103 | response.mustcontain("""1 file changed with 2 insertions and 0 deletions""") | |
104 |
|
104 | |||
105 | response.mustcontain("""<div class="message tooltip" title="commit2" style="white-space:normal">commit2</div>""") |
|
105 | response.mustcontain("""<div class="message tooltip" title="commit2" style="white-space:normal">commit2</div>""") | |
106 | response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""") |
|
106 | response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""") | |
107 |
|
107 | |||
108 | response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id)) |
|
108 | response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id)) | |
109 | response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id)) |
|
109 | response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id)) | |
110 | ## files |
|
110 | ## files | |
111 | response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s#C--826e8142e6ba">file1</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name)) |
|
111 | response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s#C--826e8142e6ba">file1</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name)) | |
112 |
|
112 | #swap | ||
|
113 | response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?as_form=None&other_repo=%s">[swap]</a>""" % (repo1.repo_name, rev1, rev2, repo2.repo_name)) | |||
113 | finally: |
|
114 | finally: | |
114 | RepoModel().delete(r2_id) |
|
115 | RepoModel().delete(r2_id) | |
115 | RepoModel().delete(r1_id) |
|
116 | RepoModel().delete(r1_id) | |
116 |
|
117 | |||
117 | def test_compare_forks_on_branch_extra_commits_origin_has_incomming_hg(self): |
|
118 | def test_compare_forks_on_branch_extra_commits_origin_has_incomming_hg(self): | |
118 | self.log_user() |
|
119 | self.log_user() | |
119 |
|
120 | |||
120 | repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg', |
|
121 | repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg', | |
121 | description='diff-test', |
|
122 | description='diff-test', | |
122 | owner=TEST_USER_ADMIN_LOGIN) |
|
123 | owner=TEST_USER_ADMIN_LOGIN) | |
123 | r1_id = repo1.repo_id |
|
124 | r1_id = repo1.repo_id | |
124 | Session().commit() |
|
125 | Session().commit() | |
125 | #commit something ! |
|
126 | #commit something ! | |
126 | cs0 = _commit_change(repo1.repo_name, filename='file1', content='line1\n', |
|
127 | cs0 = _commit_change(repo1.repo_name, filename='file1', content='line1\n', | |
127 | message='commit1', vcs_type='hg', parent=None, newfile=True) |
|
128 | message='commit1', vcs_type='hg', parent=None, newfile=True) | |
128 |
|
129 | |||
129 | #fork this repo |
|
130 | #fork this repo | |
130 | repo2 = _fork_repo('one-fork', 'hg', parent='one') |
|
131 | repo2 = _fork_repo('one-fork', 'hg', parent='one') | |
131 | Session().commit() |
|
132 | Session().commit() | |
132 |
|
133 | |||
133 | #now commit something to origin repo |
|
134 | #now commit something to origin repo | |
134 | cs1_prim = _commit_change(repo1.repo_name, filename='file2', content='line1file2\n', |
|
135 | cs1_prim = _commit_change(repo1.repo_name, filename='file2', content='line1file2\n', | |
135 | message='commit2', vcs_type='hg', parent=cs0, newfile=True) |
|
136 | message='commit2', vcs_type='hg', parent=cs0, newfile=True) | |
136 |
|
137 | |||
137 | r2_id = repo2.repo_id |
|
138 | r2_id = repo2.repo_id | |
138 |
|
139 | |||
139 | #add two extra commit into fork |
|
140 | #add two extra commit into fork | |
140 | cs1 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\n', |
|
141 | cs1 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\n', | |
141 | message='commit2', vcs_type='hg', parent=cs0) |
|
142 | message='commit2', vcs_type='hg', parent=cs0) | |
142 |
|
143 | |||
143 | cs2 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\nline3\n', |
|
144 | cs2 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\nline3\n', | |
144 | message='commit3', vcs_type='hg', parent=cs1) |
|
145 | message='commit3', vcs_type='hg', parent=cs1) | |
145 |
|
146 | |||
146 | rev1 = 'default' |
|
147 | rev1 = 'default' | |
147 | rev2 = 'default' |
|
148 | rev2 = 'default' | |
148 | response = self.app.get(url(controller='compare', action='index', |
|
149 | response = self.app.get(url(controller='compare', action='index', | |
149 | repo_name=repo2.repo_name, |
|
150 | repo_name=repo2.repo_name, | |
150 | org_ref_type="branch", |
|
151 | org_ref_type="branch", | |
151 | org_ref=rev1, |
|
152 | org_ref=rev1, | |
152 | other_repo=repo1.repo_name, |
|
153 | other_repo=repo1.repo_name, | |
153 | other_ref_type="branch", |
|
154 | other_ref_type="branch", | |
154 | other_ref=rev2, |
|
155 | other_ref=rev2, | |
155 | )) |
|
156 | )) | |
156 |
|
157 | |||
157 | try: |
|
158 | try: | |
158 | response.mustcontain('%s@%s -> %s@%s' % (repo2.repo_name, rev1, repo1.repo_name, rev2)) |
|
159 | response.mustcontain('%s@%s -> %s@%s' % (repo2.repo_name, rev1, repo1.repo_name, rev2)) | |
159 | response.mustcontain("""Showing 2 commits""") |
|
160 | response.mustcontain("""Showing 2 commits""") | |
160 | response.mustcontain("""1 file changed with 2 insertions and 0 deletions""") |
|
161 | response.mustcontain("""1 file changed with 2 insertions and 0 deletions""") | |
161 |
|
162 | |||
162 | response.mustcontain("""<div class="message tooltip" title="commit2" style="white-space:normal">commit2</div>""") |
|
163 | response.mustcontain("""<div class="message tooltip" title="commit2" style="white-space:normal">commit2</div>""") | |
163 | response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""") |
|
164 | response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""") | |
164 |
|
165 | |||
165 | response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id)) |
|
166 | response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id)) | |
166 | response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id)) |
|
167 | response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id)) | |
167 | ## files |
|
168 | ## files | |
168 | response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s#C--826e8142e6ba">file1</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name)) |
|
169 | response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s#C--826e8142e6ba">file1</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name)) | |
169 |
|
170 | #swap | ||
|
171 | response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?as_form=None&other_repo=%s">[swap]</a>""" % (repo1.repo_name, rev1, rev2, repo2.repo_name)) | |||
170 | finally: |
|
172 | finally: | |
171 | RepoModel().delete(r2_id) |
|
173 | RepoModel().delete(r2_id) | |
172 | RepoModel().delete(r1_id) |
|
174 | RepoModel().delete(r1_id) | |
173 |
|
175 | |||
174 |
|
176 | |||
175 | # def test_compare_remote_repos_remote_flag_off(self): |
|
177 | # def test_compare_remote_repos_remote_flag_off(self): | |
176 | # self.log_user() |
|
178 | # self.log_user() | |
177 | # _fork_repo(HG_FORK, 'hg') |
|
179 | # _fork_repo(HG_FORK, 'hg') | |
178 | # |
|
180 | # | |
179 | # rev1 = '56349e29c2af' |
|
181 | # rev1 = '56349e29c2af' | |
180 | # rev2 = '7d4bc8ec6be5' |
|
182 | # rev2 = '7d4bc8ec6be5' | |
181 | # |
|
183 | # | |
182 | # response = self.app.get(url(controller='compare', action='index', |
|
184 | # response = self.app.get(url(controller='compare', action='index', | |
183 | # repo_name=HG_REPO, |
|
185 | # repo_name=HG_REPO, | |
184 | # org_ref_type="rev", |
|
186 | # org_ref_type="rev", | |
185 | # org_ref=rev1, |
|
187 | # org_ref=rev1, | |
186 | # other_ref_type="rev", |
|
188 | # other_ref_type="rev", | |
187 | # other_ref=rev2, |
|
189 | # other_ref=rev2, | |
188 | # repo=HG_FORK, |
|
190 | # repo=HG_FORK, | |
189 | # bundle=False, |
|
191 | # bundle=False, | |
190 | # )) |
|
192 | # )) | |
191 | # |
|
193 | # | |
192 | # try: |
|
194 | # try: | |
193 | # response.mustcontain('%s@%s -> %s@%s' % (HG_REPO, rev1, HG_FORK, rev2)) |
|
195 | # response.mustcontain('%s@%s -> %s@%s' % (HG_REPO, rev1, HG_FORK, rev2)) | |
194 | # ## outgoing changesets between those revisions |
|
196 | # ## outgoing changesets between those revisions | |
195 | # |
|
197 | # | |
196 | # response.mustcontain("""<a href="/%s/changeset/2dda4e345facb0ccff1a191052dd1606dba6781d">r4:2dda4e345fac</a>""" % (HG_REPO)) |
|
198 | # response.mustcontain("""<a href="/%s/changeset/2dda4e345facb0ccff1a191052dd1606dba6781d">r4:2dda4e345fac</a>""" % (HG_REPO)) | |
197 | # response.mustcontain("""<a href="/%s/changeset/6fff84722075f1607a30f436523403845f84cd9e">r5:6fff84722075</a>""" % (HG_REPO)) |
|
199 | # response.mustcontain("""<a href="/%s/changeset/6fff84722075f1607a30f436523403845f84cd9e">r5:6fff84722075</a>""" % (HG_REPO)) | |
198 | # response.mustcontain("""<a href="/%s/changeset/7d4bc8ec6be56c0f10425afb40b6fc315a4c25e7">r6:%s</a>""" % (HG_REPO, rev2)) |
|
200 | # response.mustcontain("""<a href="/%s/changeset/7d4bc8ec6be56c0f10425afb40b6fc315a4c25e7">r6:%s</a>""" % (HG_REPO, rev2)) | |
199 | # |
|
201 | # | |
200 | # ## files |
|
202 | # ## files | |
201 | # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--9c390eb52cd6">vcs/backends/hg.py</a>""" % (HG_REPO, rev1, rev2)) |
|
203 | # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--9c390eb52cd6">vcs/backends/hg.py</a>""" % (HG_REPO, rev1, rev2)) | |
202 | # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--41b41c1f2796">vcs/backends/__init__.py</a>""" % (HG_REPO, rev1, rev2)) |
|
204 | # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--41b41c1f2796">vcs/backends/__init__.py</a>""" % (HG_REPO, rev1, rev2)) | |
203 | # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--2f574d260608">vcs/backends/base.py</a>""" % (HG_REPO, rev1, rev2)) |
|
205 | # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--2f574d260608">vcs/backends/base.py</a>""" % (HG_REPO, rev1, rev2)) | |
204 | # finally: |
|
206 | # finally: | |
205 | # RepoModel().delete(HG_FORK) |
|
207 | # RepoModel().delete(HG_FORK) | |
206 |
|
208 | |||
207 |
|
209 | |||
208 |
|
210 | |||
209 | # |
|
211 | # | |
210 | # def test_compare_remote_branches_hg(self): |
|
212 | # def test_compare_remote_branches_hg(self): | |
211 | # self.log_user() |
|
213 | # self.log_user() | |
212 | # |
|
214 | # | |
213 | # _fork_repo(HG_FORK, 'hg') |
|
215 | # _fork_repo(HG_FORK, 'hg') | |
214 | # |
|
216 | # | |
215 | # rev1 = '56349e29c2af' |
|
217 | # rev1 = '56349e29c2af' | |
216 | # rev2 = '7d4bc8ec6be5' |
|
218 | # rev2 = '7d4bc8ec6be5' | |
217 | # |
|
219 | # | |
218 | # response = self.app.get(url(controller='compare', action='index', |
|
220 | # response = self.app.get(url(controller='compare', action='index', | |
219 | # repo_name=HG_REPO, |
|
221 | # repo_name=HG_REPO, | |
220 | # org_ref_type="rev", |
|
222 | # org_ref_type="rev", | |
221 | # org_ref=rev1, |
|
223 | # org_ref=rev1, | |
222 | # other_ref_type="rev", |
|
224 | # other_ref_type="rev", | |
223 | # other_ref=rev2, |
|
225 | # other_ref=rev2, | |
224 | # repo=HG_FORK, |
|
226 | # repo=HG_FORK, | |
225 | # )) |
|
227 | # )) | |
226 | # |
|
228 | # | |
227 | # try: |
|
229 | # try: | |
228 | # response.mustcontain('%s@%s -> %s@%s' % (HG_REPO, rev1, HG_FORK, rev2)) |
|
230 | # response.mustcontain('%s@%s -> %s@%s' % (HG_REPO, rev1, HG_FORK, rev2)) | |
229 | # ## outgoing changesets between those revisions |
|
231 | # ## outgoing changesets between those revisions | |
230 | # |
|
232 | # | |
231 | # response.mustcontain("""<a href="/%s/changeset/2dda4e345facb0ccff1a191052dd1606dba6781d">r4:2dda4e345fac</a>""" % (HG_REPO)) |
|
233 | # response.mustcontain("""<a href="/%s/changeset/2dda4e345facb0ccff1a191052dd1606dba6781d">r4:2dda4e345fac</a>""" % (HG_REPO)) | |
232 | # response.mustcontain("""<a href="/%s/changeset/6fff84722075f1607a30f436523403845f84cd9e">r5:6fff84722075</a>""" % (HG_REPO)) |
|
234 | # response.mustcontain("""<a href="/%s/changeset/6fff84722075f1607a30f436523403845f84cd9e">r5:6fff84722075</a>""" % (HG_REPO)) | |
233 | # response.mustcontain("""<a href="/%s/changeset/7d4bc8ec6be56c0f10425afb40b6fc315a4c25e7">r6:%s</a>""" % (HG_REPO, rev2)) |
|
235 | # response.mustcontain("""<a href="/%s/changeset/7d4bc8ec6be56c0f10425afb40b6fc315a4c25e7">r6:%s</a>""" % (HG_REPO, rev2)) | |
234 | # |
|
236 | # | |
235 | # ## files |
|
237 | # ## files | |
236 | # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--9c390eb52cd6">vcs/backends/hg.py</a>""" % (HG_REPO, rev1, rev2)) |
|
238 | # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--9c390eb52cd6">vcs/backends/hg.py</a>""" % (HG_REPO, rev1, rev2)) | |
237 | # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--41b41c1f2796">vcs/backends/__init__.py</a>""" % (HG_REPO, rev1, rev2)) |
|
239 | # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--41b41c1f2796">vcs/backends/__init__.py</a>""" % (HG_REPO, rev1, rev2)) | |
238 | # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--2f574d260608">vcs/backends/base.py</a>""" % (HG_REPO, rev1, rev2)) |
|
240 | # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--2f574d260608">vcs/backends/base.py</a>""" % (HG_REPO, rev1, rev2)) | |
239 | # finally: |
|
241 | # finally: | |
240 | # RepoModel().delete(HG_FORK) |
|
242 | # RepoModel().delete(HG_FORK) | |
241 | # |
|
243 | # | |
242 | # def test_org_repo_new_commits_after_forking_simple_diff(self): |
|
244 | # def test_org_repo_new_commits_after_forking_simple_diff(self): | |
243 | # self.log_user() |
|
245 | # self.log_user() | |
244 | # |
|
246 | # | |
245 | # repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg', |
|
247 | # repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg', | |
246 | # description='diff-test', |
|
248 | # description='diff-test', | |
247 | # owner=TEST_USER_ADMIN_LOGIN) |
|
249 | # owner=TEST_USER_ADMIN_LOGIN) | |
248 | # |
|
250 | # | |
249 | # Session().commit() |
|
251 | # Session().commit() | |
250 | # r1_id = repo1.repo_id |
|
252 | # r1_id = repo1.repo_id | |
251 | # r1_name = repo1.repo_name |
|
253 | # r1_name = repo1.repo_name | |
252 | # |
|
254 | # | |
253 | # #commit something initially ! |
|
255 | # #commit something initially ! | |
254 | # cs0 = ScmModel().create_node( |
|
256 | # cs0 = ScmModel().create_node( | |
255 | # repo=repo1.scm_instance, repo_name=r1_name, |
|
257 | # repo=repo1.scm_instance, repo_name=r1_name, | |
256 | # cs=EmptyChangeset(alias='hg'), user=TEST_USER_ADMIN_LOGIN, |
|
258 | # cs=EmptyChangeset(alias='hg'), user=TEST_USER_ADMIN_LOGIN, | |
257 | # author=TEST_USER_ADMIN_LOGIN, |
|
259 | # author=TEST_USER_ADMIN_LOGIN, | |
258 | # message='commit1', |
|
260 | # message='commit1', | |
259 | # content='line1', |
|
261 | # content='line1', | |
260 | # f_path='file1' |
|
262 | # f_path='file1' | |
261 | # ) |
|
263 | # ) | |
262 | # Session().commit() |
|
264 | # Session().commit() | |
263 | # self.assertEqual(repo1.scm_instance.revisions, [cs0.raw_id]) |
|
265 | # self.assertEqual(repo1.scm_instance.revisions, [cs0.raw_id]) | |
264 | # #fork the repo1 |
|
266 | # #fork the repo1 | |
265 | # repo2 = RepoModel().create_repo(repo_name='one-fork', repo_type='hg', |
|
267 | # repo2 = RepoModel().create_repo(repo_name='one-fork', repo_type='hg', | |
266 | # description='compare-test', |
|
268 | # description='compare-test', | |
267 | # clone_uri=repo1.repo_full_path, |
|
269 | # clone_uri=repo1.repo_full_path, | |
268 | # owner=TEST_USER_ADMIN_LOGIN, fork_of='one') |
|
270 | # owner=TEST_USER_ADMIN_LOGIN, fork_of='one') | |
269 | # Session().commit() |
|
271 | # Session().commit() | |
270 | # self.assertEqual(repo2.scm_instance.revisions, [cs0.raw_id]) |
|
272 | # self.assertEqual(repo2.scm_instance.revisions, [cs0.raw_id]) | |
271 | # r2_id = repo2.repo_id |
|
273 | # r2_id = repo2.repo_id | |
272 | # r2_name = repo2.repo_name |
|
274 | # r2_name = repo2.repo_name | |
273 | # |
|
275 | # | |
274 | # #make 3 new commits in fork |
|
276 | # #make 3 new commits in fork | |
275 | # cs1 = ScmModel().create_node( |
|
277 | # cs1 = ScmModel().create_node( | |
276 | # repo=repo2.scm_instance, repo_name=r2_name, |
|
278 | # repo=repo2.scm_instance, repo_name=r2_name, | |
277 | # cs=repo2.scm_instance[-1], user=TEST_USER_ADMIN_LOGIN, |
|
279 | # cs=repo2.scm_instance[-1], user=TEST_USER_ADMIN_LOGIN, | |
278 | # author=TEST_USER_ADMIN_LOGIN, |
|
280 | # author=TEST_USER_ADMIN_LOGIN, | |
279 | # message='commit1-fork', |
|
281 | # message='commit1-fork', | |
280 | # content='file1-line1-from-fork', |
|
282 | # content='file1-line1-from-fork', | |
281 | # f_path='file1-fork' |
|
283 | # f_path='file1-fork' | |
282 | # ) |
|
284 | # ) | |
283 | # cs2 = ScmModel().create_node( |
|
285 | # cs2 = ScmModel().create_node( | |
284 | # repo=repo2.scm_instance, repo_name=r2_name, |
|
286 | # repo=repo2.scm_instance, repo_name=r2_name, | |
285 | # cs=cs1, user=TEST_USER_ADMIN_LOGIN, |
|
287 | # cs=cs1, user=TEST_USER_ADMIN_LOGIN, | |
286 | # author=TEST_USER_ADMIN_LOGIN, |
|
288 | # author=TEST_USER_ADMIN_LOGIN, | |
287 | # message='commit2-fork', |
|
289 | # message='commit2-fork', | |
288 | # content='file2-line1-from-fork', |
|
290 | # content='file2-line1-from-fork', | |
289 | # f_path='file2-fork' |
|
291 | # f_path='file2-fork' | |
290 | # ) |
|
292 | # ) | |
291 | # cs3 = ScmModel().create_node( |
|
293 | # cs3 = ScmModel().create_node( | |
292 | # repo=repo2.scm_instance, repo_name=r2_name, |
|
294 | # repo=repo2.scm_instance, repo_name=r2_name, | |
293 | # cs=cs2, user=TEST_USER_ADMIN_LOGIN, |
|
295 | # cs=cs2, user=TEST_USER_ADMIN_LOGIN, | |
294 | # author=TEST_USER_ADMIN_LOGIN, |
|
296 | # author=TEST_USER_ADMIN_LOGIN, | |
295 | # message='commit3-fork', |
|
297 | # message='commit3-fork', | |
296 | # content='file3-line1-from-fork', |
|
298 | # content='file3-line1-from-fork', | |
297 | # f_path='file3-fork' |
|
299 | # f_path='file3-fork' | |
298 | # ) |
|
300 | # ) | |
299 | # |
|
301 | # | |
300 | # #compare ! |
|
302 | # #compare ! | |
301 | # rev1 = 'default' |
|
303 | # rev1 = 'default' | |
302 | # rev2 = 'default' |
|
304 | # rev2 = 'default' | |
303 | # response = self.app.get(url(controller='compare', action='index', |
|
305 | # response = self.app.get(url(controller='compare', action='index', | |
304 | # repo_name=r2_name, |
|
306 | # repo_name=r2_name, | |
305 | # org_ref_type="branch", |
|
307 | # org_ref_type="branch", | |
306 | # org_ref=rev1, |
|
308 | # org_ref=rev1, | |
307 | # other_ref_type="branch", |
|
309 | # other_ref_type="branch", | |
308 | # other_ref=rev2, |
|
310 | # other_ref=rev2, | |
309 | # repo=r1_name, |
|
311 | # repo=r1_name, | |
310 | # bundle=False, |
|
312 | # bundle=False, | |
311 | # )) |
|
313 | # )) | |
312 | # |
|
314 | # | |
313 | # try: |
|
315 | # try: | |
314 | # #response.mustcontain('%s@%s -> %s@%s' % (r2_name, rev1, r1_name, rev2)) |
|
316 | # #response.mustcontain('%s@%s -> %s@%s' % (r2_name, rev1, r1_name, rev2)) | |
315 | # |
|
317 | # | |
316 | # #add new commit into parent ! |
|
318 | # #add new commit into parent ! | |
317 | # cs0 = ScmModel().create_node( |
|
319 | # cs0 = ScmModel().create_node( | |
318 | # repo=repo1.scm_instance, repo_name=r1_name, |
|
320 | # repo=repo1.scm_instance, repo_name=r1_name, | |
319 | # cs=EmptyChangeset(alias='hg'), user=TEST_USER_ADMIN_LOGIN, |
|
321 | # cs=EmptyChangeset(alias='hg'), user=TEST_USER_ADMIN_LOGIN, | |
320 | # author=TEST_USER_ADMIN_LOGIN, |
|
322 | # author=TEST_USER_ADMIN_LOGIN, | |
321 | # message='commit2', |
|
323 | # message='commit2', | |
322 | # content='line1', |
|
324 | # content='line1', | |
323 | # f_path='file2' |
|
325 | # f_path='file2' | |
324 | # ) |
|
326 | # ) | |
325 | # #compare ! |
|
327 | # #compare ! | |
326 | # rev1 = 'default' |
|
328 | # rev1 = 'default' | |
327 | # rev2 = 'default' |
|
329 | # rev2 = 'default' | |
328 | # response = self.app.get(url(controller='compare', action='index', |
|
330 | # response = self.app.get(url(controller='compare', action='index', | |
329 | # repo_name=r2_name, |
|
331 | # repo_name=r2_name, | |
330 | # org_ref_type="branch", |
|
332 | # org_ref_type="branch", | |
331 | # org_ref=rev1, |
|
333 | # org_ref=rev1, | |
332 | # other_ref_type="branch", |
|
334 | # other_ref_type="branch", | |
333 | # other_ref=rev2, |
|
335 | # other_ref=rev2, | |
334 | # repo=r1_name, |
|
336 | # repo=r1_name, | |
335 | # bundle=False |
|
337 | # bundle=False | |
336 | # )) |
|
338 | # )) | |
337 | # |
|
339 | # | |
338 | # response.mustcontain('%s@%s -> %s@%s' % (r2_name, rev1, r1_name, rev2)) |
|
340 | # response.mustcontain('%s@%s -> %s@%s' % (r2_name, rev1, r1_name, rev2)) | |
339 | # response.mustcontain("""file1-line1-from-fork""") |
|
341 | # response.mustcontain("""file1-line1-from-fork""") | |
340 | # response.mustcontain("""file2-line1-from-fork""") |
|
342 | # response.mustcontain("""file2-line1-from-fork""") | |
341 | # response.mustcontain("""file3-line1-from-fork""") |
|
343 | # response.mustcontain("""file3-line1-from-fork""") | |
342 | # self.assertFalse("""<a href="#">file2</a>""" in response.body) # new commit from parent |
|
344 | # self.assertFalse("""<a href="#">file2</a>""" in response.body) # new commit from parent | |
343 | # self.assertFalse("""line1-from-new-parent""" in response.body) |
|
345 | # self.assertFalse("""line1-from-new-parent""" in response.body) | |
344 | # finally: |
|
346 | # finally: | |
345 | # RepoModel().delete(r2_id) |
|
347 | # RepoModel().delete(r2_id) | |
346 | # RepoModel().delete(r1_id) |
|
348 | # RepoModel().delete(r1_id) |
General Comments 0
You need to be logged in to leave comments.
Login now