##// END OF EJS Templates
fixes #550 mercurial repositories comparision failed when origin repo had...
marcink -
r2801:69420c48 beta
parent child Browse files
Show More
@@ -30,7 +30,8 b' fixes'
30 30 resets default user permission to initial state if there is a need for that.
31 31 Also forces users to set the default value for new forking permission.
32 32 - #535 improved apache wsgi example configuration in docs
33
33 - fixes #550 mercurial repositories comparision failed when origin repo had
34 additional not-common changesets
34 35
35 36 1.4.0 (**2012-09-03**)
36 37 ----------------------
@@ -610,7 +610,7 b' def differ(org_repo, org_ref, other_repo'
610 610 other_repo.ui.setconfig('hooks', k, None)
611 611
612 612 unbundle = other_repo.getbundle('incoming', common=common,
613 heads=rheads)
613 heads=None)
614 614
615 615 buf = BytesIO()
616 616 while True:
@@ -14,4 +14,5 b' from mercurial.node import hex'
14 14 from mercurial.encoding import tolocal
15 15 from mercurial import discovery
16 16 from mercurial import localrepo
17 from mercurial import scmutil No newline at end of file
17 from mercurial import scmutil
18 from mercurial.discovery import findcommonoutgoing No newline at end of file
@@ -36,7 +36,8 b' from rhodecode.model.db import PullReque'
36 36 from rhodecode.model.notification import NotificationModel
37 37 from rhodecode.lib.utils2 import safe_unicode
38 38
39 from rhodecode.lib.vcs.utils.hgcompat import discovery, localrepo, scmutil
39 from rhodecode.lib.vcs.utils.hgcompat import discovery, localrepo, scmutil, \
40 findcommonoutgoing
40 41
41 42 log = logging.getLogger(__name__)
42 43
@@ -164,7 +165,9 b' class PullRequestModel(BaseModel):'
164 165 #case two independent repos
165 166 common, incoming, rheads = discovery_data
166 167 if org_repo != other_repo and incoming:
167 revs = org_repo._repo.changelog.findmissing(common, rheads)
168 obj = findcommonoutgoing(org_repo._repo,
169 localrepo.locallegacypeer(other_repo._repo.local()))
170 revs = obj.missing
168 171
169 172 for cs in reversed(map(binascii.hexlify, revs)):
170 173 changesets.append(org_repo.get_changeset(cs))
@@ -183,7 +183,111 b' class TestCompareController(TestControll'
183 183 ## files
184 184 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s#C--826e8142e6ba">file1</a>""" % (r2_name, rev1, rev2))
185 185
186
187 186 finally:
188 187 RepoModel().delete(r1_id)
189 188 RepoModel().delete(r2_id)
189
190 def test_org_repo_new_commits_after_forking(self):
191 self.log_user()
192
193 repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg',
194 description='diff-test',
195 owner=TEST_USER_ADMIN_LOGIN)
196
197 Session().commit()
198 r1_id = repo1.repo_id
199 r1_name = repo1.repo_name
200
201 #commit something initially !
202 cs0 = ScmModel().create_node(
203 repo=repo1.scm_instance, repo_name=r1_name,
204 cs=EmptyChangeset(alias='hg'), user=TEST_USER_ADMIN_LOGIN,
205 author=TEST_USER_ADMIN_LOGIN,
206 message='commit1',
207 content='line1',
208 f_path='file1'
209 )
210 Session().commit()
211 self.assertEqual(repo1.scm_instance.revisions, [cs0.raw_id])
212 #fork the repo1
213 repo2 = RepoModel().create_repo(repo_name='one-fork', repo_type='hg',
214 description='compare-test',
215 clone_uri=repo1.repo_full_path,
216 owner=TEST_USER_ADMIN_LOGIN, fork_of='one')
217 Session().commit()
218 self.assertEqual(repo2.scm_instance.revisions, [cs0.raw_id])
219 r2_id = repo2.repo_id
220 r2_name = repo2.repo_name
221
222 #make 3 new commits in fork
223 cs1 = ScmModel().create_node(
224 repo=repo2.scm_instance, repo_name=r2_name,
225 cs=repo2.scm_instance[-1], user=TEST_USER_ADMIN_LOGIN,
226 author=TEST_USER_ADMIN_LOGIN,
227 message='commit1-fork',
228 content='file1-line1-from-fork',
229 f_path='file1-fork'
230 )
231 cs2 = ScmModel().create_node(
232 repo=repo2.scm_instance, repo_name=r2_name,
233 cs=cs1, user=TEST_USER_ADMIN_LOGIN,
234 author=TEST_USER_ADMIN_LOGIN,
235 message='commit2-fork',
236 content='file2-line1-from-fork',
237 f_path='file2-fork'
238 )
239 cs3 = ScmModel().create_node(
240 repo=repo2.scm_instance, repo_name=r2_name,
241 cs=cs2, user=TEST_USER_ADMIN_LOGIN,
242 author=TEST_USER_ADMIN_LOGIN,
243 message='commit3-fork',
244 content='file3-line1-from-fork',
245 f_path='file3-fork'
246 )
247
248 #compare !
249 rev1 = 'default'
250 rev2 = 'default'
251 response = self.app.get(url(controller='compare', action='index',
252 repo_name=r2_name,
253 org_ref_type="branch",
254 org_ref=rev1,
255 other_ref_type="branch",
256 other_ref=rev2,
257 repo=r1_name
258 ))
259
260 try:
261 response.mustcontain('%s@%s -> %s@%s' % (r2_name, rev1, r1_name, rev2))
262 response.mustcontain("""file1-line1-from-fork""")
263 response.mustcontain("""file2-line1-from-fork""")
264 response.mustcontain("""file3-line1-from-fork""")
265
266 #add new commit into parent !
267 cs0 = ScmModel().create_node(
268 repo=repo1.scm_instance, repo_name=r1_name,
269 cs=EmptyChangeset(alias='hg'), user=TEST_USER_ADMIN_LOGIN,
270 author=TEST_USER_ADMIN_LOGIN,
271 message='commit2',
272 content='line1',
273 f_path='file2'
274 )
275 #compare !
276 rev1 = 'default'
277 rev2 = 'default'
278 response = self.app.get(url(controller='compare', action='index',
279 repo_name=r2_name,
280 org_ref_type="branch",
281 org_ref=rev1,
282 other_ref_type="branch",
283 other_ref=rev2,
284 repo=r1_name
285 ))
286
287 response.mustcontain('%s@%s -> %s@%s' % (r2_name, rev1, r1_name, rev2))
288 response.mustcontain("""file1-line1-from-fork""")
289 response.mustcontain("""file2-line1-from-fork""")
290 response.mustcontain("""file3-line1-from-fork""")
291 finally:
292 RepoModel().delete(r1_id)
293 RepoModel().delete(r2_id)
General Comments 0
You need to be logged in to leave comments. Login now