from rhodecode.tests import * from rhodecode.model.repo import RepoModel from rhodecode.model.meta import Session from rhodecode.model.db import Repository from rhodecode.model.scm import ScmModel from rhodecode.lib.vcs.backends.base import EmptyChangeset class TestCompareController(TestController): def test_compare_tag_hg(self): self.log_user() tag1 = 'v0.1.2' tag2 = 'v0.1.3' response = self.app.get(url(controller='compare', action='index', repo_name=HG_REPO, org_ref_type="tag", org_ref=tag1, other_ref_type="tag", other_ref=tag2, ), status=200) response.mustcontain('%s@%s -> %s@%s' % (HG_REPO, tag1, HG_REPO, tag2)) ## outgoing changesets between tags response.mustcontain('''r112:c5ddebc06eaa''' % HG_REPO) response.mustcontain('''r115:70d4cef8a376''' % HG_REPO) response.mustcontain('''r116:9749bfbfc0d2''' % HG_REPO) response.mustcontain('''r117:41fda979f02f''' % HG_REPO) response.mustcontain('''r118:bb1a3ab98cc4''' % HG_REPO) response.mustcontain('''r119:36e0fc9d2808''' % HG_REPO) response.mustcontain('''r120:17544fbfcd33''' % HG_REPO) response.mustcontain('11 files changed with 94 insertions and 64 deletions') ## files diff response.mustcontain('''
''' % (HG_REPO, tag1, tag2)) response.mustcontain('''''' % (HG_REPO, tag1, tag2)) response.mustcontain('''''' % (HG_REPO, tag1, tag2)) response.mustcontain('''''' % (HG_REPO, tag1, tag2)) response.mustcontain('''''' % (HG_REPO, tag1, tag2)) response.mustcontain('''''' % (HG_REPO, tag1, tag2)) response.mustcontain('''''' % (HG_REPO, tag1, tag2)) response.mustcontain('''''' % (HG_REPO, tag1, tag2)) response.mustcontain('''''' % (HG_REPO, tag1, tag2)) response.mustcontain('''''' % (HG_REPO, tag1, tag2)) response.mustcontain('''''' % (HG_REPO, tag1, tag2)) def test_compare_tag_git(self): self.log_user() tag1 = 'v0.1.2' tag2 = 'v0.1.3' response = self.app.get(url(controller='compare', action='index', repo_name=GIT_REPO, org_ref_type="tag", org_ref=tag1, other_ref_type="tag", other_ref=tag2, ), status=200) response.mustcontain('%s@%s -> %s@%s' % (GIT_REPO, tag1, GIT_REPO, tag2)) ## outgoing changesets between tags response.mustcontain('''r113:794bbdd31545''' % GIT_REPO) response.mustcontain('''r115:e36d8c502532''' % GIT_REPO) response.mustcontain('''r116:5c9ff4f6d750''' % GIT_REPO) response.mustcontain('''r117:b7187fa2b8c1''' % GIT_REPO) response.mustcontain('''r118:5f3b74262014''' % GIT_REPO) response.mustcontain('''r119:17438a11f72b''' % GIT_REPO) response.mustcontain('''r120:5a3a8fb00555''' % GIT_REPO) response.mustcontain('11 files changed with 94 insertions and 64 deletions') #files response.mustcontain('''docs/api/utils/index.rst''' % (GIT_REPO, tag1, tag2)) response.mustcontain('''test_and_report.sh''' % (GIT_REPO, tag1, tag2)) response.mustcontain('''.hgignore''' % (GIT_REPO, tag1, tag2)) response.mustcontain('''.hgtags''' % (GIT_REPO, tag1, tag2)) response.mustcontain('''docs/api/index.rst''' % (GIT_REPO, tag1, tag2)) response.mustcontain('''vcs/__init__.py''' % (GIT_REPO, tag1, tag2)) response.mustcontain('''vcs/backends/hg.py''' % (GIT_REPO, tag1, tag2)) response.mustcontain('''vcs/utils/__init__.py''' % (GIT_REPO, tag1, tag2)) response.mustcontain('''vcs/utils/annotate.py''' % (GIT_REPO, tag1, tag2)) response.mustcontain('''vcs/utils/diffs.py''' % (GIT_REPO, tag1, tag2)) response.mustcontain('''vcs/utils/lazy.py''' % (GIT_REPO, tag1, tag2)) def test_index_branch_hg(self): self.log_user() response = self.app.get(url(controller='compare', action='index', repo_name=HG_REPO, org_ref_type="branch", org_ref='default', other_ref_type="branch", other_ref='default', )) response.mustcontain('%s@default -> %s@default' % (HG_REPO, HG_REPO)) # branch are equal response.mustcontain('No files') response.mustcontain('No changesets') def test_index_branch_git(self): self.log_user() response = self.app.get(url(controller='compare', action='index', repo_name=GIT_REPO, org_ref_type="branch", org_ref='master', other_ref_type="branch", other_ref='master', )) response.mustcontain('%s@master -> %s@master' % (GIT_REPO, GIT_REPO)) # branch are equal response.mustcontain('No files') response.mustcontain('No changesets') def test_compare_revisions_hg(self): self.log_user() rev1 = 'b986218ba1c9' rev2 = '3d8f361e72ab' response = self.app.get(url(controller='compare', action='index', repo_name=HG_REPO, org_ref_type="rev", org_ref=rev1, other_ref_type="rev", other_ref=rev2, )) response.mustcontain('%s@%s -> %s@%s' % (HG_REPO, rev1, HG_REPO, rev2)) ## outgoing changesets between those revisions response.mustcontain("""r1:%s""" % (HG_REPO, rev2)) response.mustcontain('1 file changed with 7 insertions and 0 deletions') ## files response.mustcontain(""".hgignore""" % (HG_REPO, rev1, rev2)) def test_compare_revisions_git(self): self.log_user() rev1 = 'c1214f7e79e02fc37156ff215cd71275450cffc3' rev2 = '38b5fe81f109cb111f549bfe9bb6b267e10bc557' response = self.app.get(url(controller='compare', action='index', repo_name=GIT_REPO, org_ref_type="rev", org_ref=rev1, other_ref_type="rev", other_ref=rev2, )) response.mustcontain('%s@%s -> %s@%s' % (GIT_REPO, rev1, GIT_REPO, rev2)) ## outgoing changesets between those revisions response.mustcontain("""r1:%s""" % (GIT_REPO, rev2[:12])) response.mustcontain('1 file changed with 7 insertions and 0 deletions') ## files response.mustcontain(""".hgignore""" % (GIT_REPO, rev1, rev2))