##// END OF EJS Templates
fixed tests for databases that have FKs. Thank you sqlite...
marcink -
r3026:ff9e0cbf beta
parent child Browse files
Show More
@@ -1,346 +1,347 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_ref_type="branch",
95 other_ref_type="branch",
96 other_ref=rev2,
96 other_ref=rev2,
97 repo=repo1.repo_name
97 repo=repo1.repo_name
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#C--826e8142e6ba">file1</a>""" % (repo2.repo_name, rev1, rev2))
111 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s#C--826e8142e6ba">file1</a>""" % (repo2.repo_name, rev1, rev2))
112
112
113 finally:
113 finally:
114 RepoModel().delete(r2_id)
114 RepoModel().delete(r1_id)
115 RepoModel().delete(r1_id)
115 RepoModel().delete(r2_id)
116
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_ref_type="branch",
153 other_ref_type="branch",
153 other_ref=rev2,
154 other_ref=rev2,
154 repo=repo1.repo_name
155 repo=repo1.repo_name
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#C--826e8142e6ba">file1</a>""" % (repo2.repo_name, rev1, rev2))
169 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s#C--826e8142e6ba">file1</a>""" % (repo2.repo_name, rev1, rev2))
169
170
170 finally:
171 finally:
172 RepoModel().delete(r2_id)
171 RepoModel().delete(r1_id)
173 RepoModel().delete(r1_id)
172 RepoModel().delete(r2_id)
173
174
174
175
175 # def test_compare_remote_repos_remote_flag_off(self):
176 # def test_compare_remote_repos_remote_flag_off(self):
176 # self.log_user()
177 # self.log_user()
177 # _fork_repo(HG_FORK, 'hg')
178 # _fork_repo(HG_FORK, 'hg')
178 #
179 #
179 # rev1 = '56349e29c2af'
180 # rev1 = '56349e29c2af'
180 # rev2 = '7d4bc8ec6be5'
181 # rev2 = '7d4bc8ec6be5'
181 #
182 #
182 # response = self.app.get(url(controller='compare', action='index',
183 # response = self.app.get(url(controller='compare', action='index',
183 # repo_name=HG_REPO,
184 # repo_name=HG_REPO,
184 # org_ref_type="rev",
185 # org_ref_type="rev",
185 # org_ref=rev1,
186 # org_ref=rev1,
186 # other_ref_type="rev",
187 # other_ref_type="rev",
187 # other_ref=rev2,
188 # other_ref=rev2,
188 # repo=HG_FORK,
189 # repo=HG_FORK,
189 # bundle=False,
190 # bundle=False,
190 # ))
191 # ))
191 #
192 #
192 # try:
193 # try:
193 # response.mustcontain('%s@%s -> %s@%s' % (HG_REPO, rev1, HG_FORK, rev2))
194 # response.mustcontain('%s@%s -> %s@%s' % (HG_REPO, rev1, HG_FORK, rev2))
194 # ## outgoing changesets between those revisions
195 # ## outgoing changesets between those revisions
195 #
196 #
196 # response.mustcontain("""<a href="/%s/changeset/2dda4e345facb0ccff1a191052dd1606dba6781d">r4:2dda4e345fac</a>""" % (HG_REPO))
197 # 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))
198 # 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))
199 # response.mustcontain("""<a href="/%s/changeset/7d4bc8ec6be56c0f10425afb40b6fc315a4c25e7">r6:%s</a>""" % (HG_REPO, rev2))
199 #
200 #
200 # ## files
201 # ## files
201 # 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--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))
203 # 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))
204 # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--2f574d260608">vcs/backends/base.py</a>""" % (HG_REPO, rev1, rev2))
204 # finally:
205 # finally:
205 # RepoModel().delete(HG_FORK)
206 # RepoModel().delete(HG_FORK)
206
207
207
208
208
209
209 #
210 #
210 # def test_compare_remote_branches_hg(self):
211 # def test_compare_remote_branches_hg(self):
211 # self.log_user()
212 # self.log_user()
212 #
213 #
213 # _fork_repo(HG_FORK, 'hg')
214 # _fork_repo(HG_FORK, 'hg')
214 #
215 #
215 # rev1 = '56349e29c2af'
216 # rev1 = '56349e29c2af'
216 # rev2 = '7d4bc8ec6be5'
217 # rev2 = '7d4bc8ec6be5'
217 #
218 #
218 # response = self.app.get(url(controller='compare', action='index',
219 # response = self.app.get(url(controller='compare', action='index',
219 # repo_name=HG_REPO,
220 # repo_name=HG_REPO,
220 # org_ref_type="rev",
221 # org_ref_type="rev",
221 # org_ref=rev1,
222 # org_ref=rev1,
222 # other_ref_type="rev",
223 # other_ref_type="rev",
223 # other_ref=rev2,
224 # other_ref=rev2,
224 # repo=HG_FORK,
225 # repo=HG_FORK,
225 # ))
226 # ))
226 #
227 #
227 # try:
228 # try:
228 # response.mustcontain('%s@%s -> %s@%s' % (HG_REPO, rev1, HG_FORK, rev2))
229 # response.mustcontain('%s@%s -> %s@%s' % (HG_REPO, rev1, HG_FORK, rev2))
229 # ## outgoing changesets between those revisions
230 # ## outgoing changesets between those revisions
230 #
231 #
231 # response.mustcontain("""<a href="/%s/changeset/2dda4e345facb0ccff1a191052dd1606dba6781d">r4:2dda4e345fac</a>""" % (HG_REPO))
232 # 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))
233 # 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))
234 # response.mustcontain("""<a href="/%s/changeset/7d4bc8ec6be56c0f10425afb40b6fc315a4c25e7">r6:%s</a>""" % (HG_REPO, rev2))
234 #
235 #
235 # ## files
236 # ## files
236 # 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--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))
238 # 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))
239 # response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--2f574d260608">vcs/backends/base.py</a>""" % (HG_REPO, rev1, rev2))
239 # finally:
240 # finally:
240 # RepoModel().delete(HG_FORK)
241 # RepoModel().delete(HG_FORK)
241 #
242 #
242 # def test_org_repo_new_commits_after_forking_simple_diff(self):
243 # def test_org_repo_new_commits_after_forking_simple_diff(self):
243 # self.log_user()
244 # self.log_user()
244 #
245 #
245 # repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg',
246 # repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg',
246 # description='diff-test',
247 # description='diff-test',
247 # owner=TEST_USER_ADMIN_LOGIN)
248 # owner=TEST_USER_ADMIN_LOGIN)
248 #
249 #
249 # Session().commit()
250 # Session().commit()
250 # r1_id = repo1.repo_id
251 # r1_id = repo1.repo_id
251 # r1_name = repo1.repo_name
252 # r1_name = repo1.repo_name
252 #
253 #
253 # #commit something initially !
254 # #commit something initially !
254 # cs0 = ScmModel().create_node(
255 # cs0 = ScmModel().create_node(
255 # repo=repo1.scm_instance, repo_name=r1_name,
256 # repo=repo1.scm_instance, repo_name=r1_name,
256 # cs=EmptyChangeset(alias='hg'), user=TEST_USER_ADMIN_LOGIN,
257 # cs=EmptyChangeset(alias='hg'), user=TEST_USER_ADMIN_LOGIN,
257 # author=TEST_USER_ADMIN_LOGIN,
258 # author=TEST_USER_ADMIN_LOGIN,
258 # message='commit1',
259 # message='commit1',
259 # content='line1',
260 # content='line1',
260 # f_path='file1'
261 # f_path='file1'
261 # )
262 # )
262 # Session().commit()
263 # Session().commit()
263 # self.assertEqual(repo1.scm_instance.revisions, [cs0.raw_id])
264 # self.assertEqual(repo1.scm_instance.revisions, [cs0.raw_id])
264 # #fork the repo1
265 # #fork the repo1
265 # repo2 = RepoModel().create_repo(repo_name='one-fork', repo_type='hg',
266 # repo2 = RepoModel().create_repo(repo_name='one-fork', repo_type='hg',
266 # description='compare-test',
267 # description='compare-test',
267 # clone_uri=repo1.repo_full_path,
268 # clone_uri=repo1.repo_full_path,
268 # owner=TEST_USER_ADMIN_LOGIN, fork_of='one')
269 # owner=TEST_USER_ADMIN_LOGIN, fork_of='one')
269 # Session().commit()
270 # Session().commit()
270 # self.assertEqual(repo2.scm_instance.revisions, [cs0.raw_id])
271 # self.assertEqual(repo2.scm_instance.revisions, [cs0.raw_id])
271 # r2_id = repo2.repo_id
272 # r2_id = repo2.repo_id
272 # r2_name = repo2.repo_name
273 # r2_name = repo2.repo_name
273 #
274 #
274 # #make 3 new commits in fork
275 # #make 3 new commits in fork
275 # cs1 = ScmModel().create_node(
276 # cs1 = ScmModel().create_node(
276 # repo=repo2.scm_instance, repo_name=r2_name,
277 # repo=repo2.scm_instance, repo_name=r2_name,
277 # cs=repo2.scm_instance[-1], user=TEST_USER_ADMIN_LOGIN,
278 # cs=repo2.scm_instance[-1], user=TEST_USER_ADMIN_LOGIN,
278 # author=TEST_USER_ADMIN_LOGIN,
279 # author=TEST_USER_ADMIN_LOGIN,
279 # message='commit1-fork',
280 # message='commit1-fork',
280 # content='file1-line1-from-fork',
281 # content='file1-line1-from-fork',
281 # f_path='file1-fork'
282 # f_path='file1-fork'
282 # )
283 # )
283 # cs2 = ScmModel().create_node(
284 # cs2 = ScmModel().create_node(
284 # repo=repo2.scm_instance, repo_name=r2_name,
285 # repo=repo2.scm_instance, repo_name=r2_name,
285 # cs=cs1, user=TEST_USER_ADMIN_LOGIN,
286 # cs=cs1, user=TEST_USER_ADMIN_LOGIN,
286 # author=TEST_USER_ADMIN_LOGIN,
287 # author=TEST_USER_ADMIN_LOGIN,
287 # message='commit2-fork',
288 # message='commit2-fork',
288 # content='file2-line1-from-fork',
289 # content='file2-line1-from-fork',
289 # f_path='file2-fork'
290 # f_path='file2-fork'
290 # )
291 # )
291 # cs3 = ScmModel().create_node(
292 # cs3 = ScmModel().create_node(
292 # repo=repo2.scm_instance, repo_name=r2_name,
293 # repo=repo2.scm_instance, repo_name=r2_name,
293 # cs=cs2, user=TEST_USER_ADMIN_LOGIN,
294 # cs=cs2, user=TEST_USER_ADMIN_LOGIN,
294 # author=TEST_USER_ADMIN_LOGIN,
295 # author=TEST_USER_ADMIN_LOGIN,
295 # message='commit3-fork',
296 # message='commit3-fork',
296 # content='file3-line1-from-fork',
297 # content='file3-line1-from-fork',
297 # f_path='file3-fork'
298 # f_path='file3-fork'
298 # )
299 # )
299 #
300 #
300 # #compare !
301 # #compare !
301 # rev1 = 'default'
302 # rev1 = 'default'
302 # rev2 = 'default'
303 # rev2 = 'default'
303 # response = self.app.get(url(controller='compare', action='index',
304 # response = self.app.get(url(controller='compare', action='index',
304 # repo_name=r2_name,
305 # repo_name=r2_name,
305 # org_ref_type="branch",
306 # org_ref_type="branch",
306 # org_ref=rev1,
307 # org_ref=rev1,
307 # other_ref_type="branch",
308 # other_ref_type="branch",
308 # other_ref=rev2,
309 # other_ref=rev2,
309 # repo=r1_name,
310 # repo=r1_name,
310 # bundle=False,
311 # bundle=False,
311 # ))
312 # ))
312 #
313 #
313 # try:
314 # try:
314 # #response.mustcontain('%s@%s -> %s@%s' % (r2_name, rev1, r1_name, rev2))
315 # #response.mustcontain('%s@%s -> %s@%s' % (r2_name, rev1, r1_name, rev2))
315 #
316 #
316 # #add new commit into parent !
317 # #add new commit into parent !
317 # cs0 = ScmModel().create_node(
318 # cs0 = ScmModel().create_node(
318 # repo=repo1.scm_instance, repo_name=r1_name,
319 # repo=repo1.scm_instance, repo_name=r1_name,
319 # cs=EmptyChangeset(alias='hg'), user=TEST_USER_ADMIN_LOGIN,
320 # cs=EmptyChangeset(alias='hg'), user=TEST_USER_ADMIN_LOGIN,
320 # author=TEST_USER_ADMIN_LOGIN,
321 # author=TEST_USER_ADMIN_LOGIN,
321 # message='commit2',
322 # message='commit2',
322 # content='line1',
323 # content='line1',
323 # f_path='file2'
324 # f_path='file2'
324 # )
325 # )
325 # #compare !
326 # #compare !
326 # rev1 = 'default'
327 # rev1 = 'default'
327 # rev2 = 'default'
328 # rev2 = 'default'
328 # response = self.app.get(url(controller='compare', action='index',
329 # response = self.app.get(url(controller='compare', action='index',
329 # repo_name=r2_name,
330 # repo_name=r2_name,
330 # org_ref_type="branch",
331 # org_ref_type="branch",
331 # org_ref=rev1,
332 # org_ref=rev1,
332 # other_ref_type="branch",
333 # other_ref_type="branch",
333 # other_ref=rev2,
334 # other_ref=rev2,
334 # repo=r1_name,
335 # repo=r1_name,
335 # bundle=False
336 # bundle=False
336 # ))
337 # ))
337 #
338 #
338 # response.mustcontain('%s@%s -> %s@%s' % (r2_name, rev1, r1_name, rev2))
339 # response.mustcontain('%s@%s -> %s@%s' % (r2_name, rev1, r1_name, rev2))
339 # response.mustcontain("""file1-line1-from-fork""")
340 # response.mustcontain("""file1-line1-from-fork""")
340 # response.mustcontain("""file2-line1-from-fork""")
341 # response.mustcontain("""file2-line1-from-fork""")
341 # response.mustcontain("""file3-line1-from-fork""")
342 # response.mustcontain("""file3-line1-from-fork""")
342 # self.assertFalse("""<a href="#">file2</a>""" in response.body) # new commit from parent
343 # self.assertFalse("""<a href="#">file2</a>""" in response.body) # new commit from parent
343 # self.assertFalse("""line1-from-new-parent""" in response.body)
344 # self.assertFalse("""line1-from-new-parent""" in response.body)
344 # finally:
345 # finally:
345 # RepoModel().delete(r2_id)
346 # RepoModel().delete(r2_id)
346 # RepoModel().delete(r1_id)
347 # RepoModel().delete(r1_id)
General Comments 0
You need to be logged in to leave comments. Login now