• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python api.Checkout类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中webkitpy.common.checkout.api.Checkout的典型用法代码示例。如果您正苦于以下问题:Python Checkout类的具体用法?Python Checkout怎么用?Python Checkout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Checkout类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_modified_changelogs

 def test_modified_changelogs(self):
     scm = Mock()
     scm.checkout_root = "/foo/bar"
     scm.changed_files = lambda git_commit: ["file1", "ChangeLog", "relative/path/ChangeLog"]
     checkout = Checkout(scm)
     expected_changlogs = ["/foo/bar/ChangeLog", "/foo/bar/relative/path/ChangeLog"]
     self.assertEqual(checkout.modified_changelogs(git_commit=None), expected_changlogs)
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:7,代码来源:api_unittest.py


示例2: test_commit_message_for_this_commit

 def test_commit_message_for_this_commit(self):
     checkout = Checkout(None)
     checkout.modified_changelogs = lambda: ["ChangeLog1", "ChangeLog2"]
     output = OutputCapture()
     expected_stderr = "Parsing ChangeLog: ChangeLog1\nParsing ChangeLog: ChangeLog2\n"
     commit_message = output.assert_outputs(self, checkout.commit_message_for_this_commit, expected_stderr=expected_stderr)
     self.assertEqual(commit_message.message(), self.expected_commit_message)
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:7,代码来源:api_unittest.py


示例3: test_latest_entry_for_changelog_at_revision

 def test_latest_entry_for_changelog_at_revision(self):
     scm = Mock()
     def mock_contents_at_revision(changelog_path, revision):
         self.assertEqual(changelog_path, "foo")
         self.assertEqual(revision, "bar")
         return _changelog1
     scm.contents_at_revision = mock_contents_at_revision
     checkout = Checkout(scm)
     entry = checkout._latest_entry_for_changelog_at_revision("foo", "bar")
     self.assertEqual(entry.contents(), _changelog1entry1)
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:10,代码来源:api_unittest.py


示例4: test_latest_entry_for_changelog_at_revision

 def test_latest_entry_for_changelog_at_revision(self):
     scm = Mock()
     def mock_contents_at_revision(changelog_path, revision):
         self.assertEqual(changelog_path, "foo")
         self.assertEqual(revision, "bar")
         # contents_at_revision is expected to return a byte array (str)
         # so we encode our unicode ChangeLog down to a utf-8 stream.
         return _changelog1.encode("utf-8")
     scm.contents_at_revision = mock_contents_at_revision
     checkout = Checkout(scm)
     entry = checkout._latest_entry_for_changelog_at_revision("foo", "bar")
     self.assertEqual(entry.contents(), _changelog1entry1)
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:12,代码来源:api_unittest.py


示例5: test_commit_info_for_revision

 def test_commit_info_for_revision(self):
     scm = Mock()
     scm.committer_email_for_revision = lambda revision: "[email protected]"
     checkout = Checkout(scm)
     checkout.changelog_entries_for_revision = lambda revision: [ChangeLogEntry(_changelog1entry1)]
     commitinfo = checkout.commit_info_for_revision(4)
     self.assertEqual(commitinfo.bug_id(), 36629)
     self.assertEqual(commitinfo.author_name(), "Eric Seidel")
     self.assertEqual(commitinfo.author_email(), "[email protected]")
     self.assertEqual(commitinfo.reviewer_text(), None)
     self.assertEqual(commitinfo.reviewer(), None)
     self.assertEqual(commitinfo.committer_email(), "[email protected]")
     self.assertEqual(commitinfo.committer(), None)
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:13,代码来源:api_unittest.py


示例6: setUp

 def setUp(self):
     SVNTestRepository.setup(self)
     self._setup_git_clone_of_svn_repository()
     os.chdir(self.git_checkout_path)
     self.scm = detect_scm_system(self.git_checkout_path)
     # For historical reasons, we test some checkout code here too.
     self.checkout = Checkout(self.scm)
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:7,代码来源:scm_unittest.py


示例7: test_suggested_reviewers

    def test_suggested_reviewers(self):
        def mock_changelog_entries_for_revision(revision):
            if revision % 2 == 0:
                return [ChangeLogEntry(_changelog1entry1)]
            return [ChangeLogEntry(_changelog1entry2)]

        def mock_revisions_changing_file(path, limit=5):
            if path.endswith("ChangeLog"):
                return [3]
            return [4, 8]

        scm = Mock()
        scm.checkout_root = "/foo/bar"
        scm.changed_files = lambda git_commit: ["file1", "file2", "relative/path/ChangeLog"]
        scm.revisions_changing_file = mock_revisions_changing_file
        checkout = Checkout(scm)
        checkout.changelog_entries_for_revision = mock_changelog_entries_for_revision
        reviewers = checkout.suggested_reviewers(git_commit=None)
        reviewer_names = [reviewer.full_name for reviewer in reviewers]
        self.assertEqual(reviewer_names, [u'Tor Arne Vestb\xf8'])
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:20,代码来源:api_unittest.py


示例8: test_bug_id_for_this_commit

 def test_bug_id_for_this_commit(self):
     scm = Mock()
     checkout = Checkout(scm)
     checkout.commit_message_for_this_commit = lambda git_commit, changed_files=None: CommitMessage(ChangeLogEntry(_changelog1entry1).contents().splitlines())
     self.assertEqual(checkout.bug_id_for_this_commit(git_commit=None), 36629)
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:5,代码来源:api_unittest.py


示例9: test_bug_id_for_revision

 def test_bug_id_for_revision(self):
     scm = Mock()
     scm.committer_email_for_revision = lambda revision: "[email protected]"
     checkout = Checkout(scm)
     checkout.changelog_entries_for_revision = lambda revision: [ChangeLogEntry(_changelog1entry1)]
     self.assertEqual(checkout.bug_id_for_revision(4), 36629)
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:6,代码来源:api_unittest.py


示例10: GitTest

class GitTest(SCMTest):

    def _setup_git_clone_of_svn_repository(self):
        self.git_checkout_path = tempfile.mkdtemp(suffix="git_test_checkout")
        # --quiet doesn't make git svn silent, so we use run_silent to redirect output
        run_silent(['git', 'svn', '--quiet', 'clone', self.svn_repo_url, self.git_checkout_path])

    def _tear_down_git_clone_of_svn_repository(self):
        run_command(['rm', '-rf', self.git_checkout_path])

    def setUp(self):
        SVNTestRepository.setup(self)
        self._setup_git_clone_of_svn_repository()
        os.chdir(self.git_checkout_path)
        self.scm = detect_scm_system(self.git_checkout_path)
        # For historical reasons, we test some checkout code here too.
        self.checkout = Checkout(self.scm)

    def tearDown(self):
        SVNTestRepository.tear_down(self)
        self._tear_down_git_clone_of_svn_repository()

    def test_detection(self):
        scm = detect_scm_system(self.git_checkout_path)
        self.assertEqual(scm.display_name(), "git")
        self.assertEqual(scm.supports_local_commits(), True)

    def test_read_git_config(self):
        key = 'test.git-config'
        value = 'git-config value'
        run_command(['git', 'config', key, value])
        self.assertEqual(self.scm.read_git_config(key), value)

    def test_local_commits(self):
        test_file = os.path.join(self.git_checkout_path, 'test_file')
        write_into_file_at_path(test_file, 'foo')
        run_command(['git', 'commit', '-a', '-m', 'local commit'])

        self.assertEqual(len(self.scm.local_commits()), 1)

    def test_discard_local_commits(self):
        test_file = os.path.join(self.git_checkout_path, 'test_file')
        write_into_file_at_path(test_file, 'foo')
        run_command(['git', 'commit', '-a', '-m', 'local commit'])

        self.assertEqual(len(self.scm.local_commits()), 1)
        self.scm.discard_local_commits()
        self.assertEqual(len(self.scm.local_commits()), 0)

    def test_delete_branch(self):
        old_branch = run_command(['git', 'symbolic-ref', 'HEAD']).strip()
        new_branch = 'foo'

        run_command(['git', 'checkout', '-b', new_branch])
        self.assertEqual(run_command(['git', 'symbolic-ref', 'HEAD']).strip(), 'refs/heads/' + new_branch)

        run_command(['git', 'checkout', old_branch])
        self.scm.delete_branch(new_branch)

        self.assertFalse(re.search(r'foo', run_command(['git', 'branch'])))

    def test_svn_merge_base(self):
        # Diff to merge-base should include working-copy changes,
        # which the diff to svn_branch.. doesn't.
        test_file = os.path.join(self.git_checkout_path, 'test_file')
        write_into_file_at_path(test_file, 'foo')

        diff_to_common_base = run_command(['git', 'diff', self.scm.svn_branch_name() + '..'])
        diff_to_merge_base = run_command(['git', 'diff', self.scm.svn_merge_base()])

        self.assertFalse(re.search(r'foo', diff_to_common_base))
        self.assertTrue(re.search(r'foo', diff_to_merge_base))

    def test_rebase_in_progress(self):
        svn_test_file = os.path.join(self.svn_checkout_path, 'test_file')
        write_into_file_at_path(svn_test_file, "svn_checkout")
        run_command(['svn', 'commit', '--message', 'commit to conflict with git commit'], cwd=self.svn_checkout_path)

        git_test_file = os.path.join(self.git_checkout_path, 'test_file')
        write_into_file_at_path(git_test_file, "git_checkout")
        run_command(['git', 'commit', '-a', '-m', 'commit to be thrown away by rebase abort'])

        # --quiet doesn't make git svn silent, so use run_silent to redirect output
        self.assertRaises(ScriptError, run_silent, ['git', 'svn', '--quiet', 'rebase']) # Will fail due to a conflict leaving us mid-rebase.

        scm = detect_scm_system(self.git_checkout_path)
        self.assertTrue(scm.rebase_in_progress())

        # Make sure our cleanup works.
        scm.clean_working_directory()
        self.assertFalse(scm.rebase_in_progress())

        # Make sure cleanup doesn't throw when no rebase is in progress.
        scm.clean_working_directory()

    def test_commitish_parsing(self):
        scm = detect_scm_system(self.git_checkout_path)
    
        # Multiple revisions are cherry-picked.
        self.assertEqual(len(scm.commit_ids_from_commitish_arguments(['HEAD~2'])), 1)
#.........这里部分代码省略.........
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:101,代码来源:scm_unittest.py



注:本文中的webkitpy.common.checkout.api.Checkout类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python baselineoptimizer.BaselineOptimizer类代码示例发布时间:2022-05-26
下一篇:
Python parser.parse函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap