How to use the pydriller.RepositoryMining function in PyDriller

To help you get started, we’ve selected a few PyDriller examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ishepard / pydriller / tests / test_repository_mining.py View on Github external
def test_both_local_and_remote_urls():
    dt2 = datetime(2018, 10, 20)
    assert len(list(RepositoryMining(
        path_to_repo=["test-repos/test1",
                      "https://github.com/ishepard/pydriller.git"],
        to=dt2).traverse_commits())) == 164
github ishepard / pydriller / tests / test_repository_mining.py View on Github external
def test_ignore_add_whitespaces_and_changed_file():
    commit = list(RepositoryMining('test-repos/test14',
                                   single="532068e9d64b8a86e07eea93de3a57bf9e5b4ae0").traverse_commits())[0]
    assert len(commit.modifications) == 2
    commit = list(RepositoryMining('test-repos/test14',
                                   skip_whitespaces=True,
                                   single="532068e9d64b8a86e07eea93de3a57bf9e5b4ae0").traverse_commits())[0]
    assert len(commit.modifications) == 1
github ishepard / pydriller / tests / test_repository_mining.py View on Github external
def test_ignore_add_whitespaces_and_changed_file():
    commit = list(RepositoryMining('test-repos/test14',
                                   single="532068e9d64b8a86e07eea93de3a57bf9e5b4ae0").traverse_commits())[0]
    assert len(commit.modifications) == 2
    commit = list(RepositoryMining('test-repos/test14',
                                   skip_whitespaces=True,
                                   single="532068e9d64b8a86e07eea93de3a57bf9e5b4ae0").traverse_commits())[0]
    assert len(commit.modifications) == 1
github ishepard / pydriller / tests / test_repository_mining.py View on Github external
def test_no_url():
    with pytest.raises(Exception):
        list(RepositoryMining().traverse_commits())
github ishepard / pydriller / tests / test_repository_mining.py View on Github external
def test_diff_histogram():
    # without histogram
    commit = list(RepositoryMining('test-repos/test13',
                                   single="93df8676e6fab70d9677e94fd0f6b17db095e890").traverse_commits())[0]
    mod = commit.modifications[0]
    gr = GitRepository('test-repos/test13')
    diff = gr.parse_diff(mod.diff)
    assert len(diff['added']) == 11
    assert (3, '    if (path == null)') in diff['added']
    assert (5, '        log.error("Icon path is null");') in diff['added']
    assert (6, '        return null;') in diff['added']
    assert (8, '') in diff['added']
    assert (9, '    java.net.URL imgURL = GuiImporter.class.getResource(path);') in diff['added']
    assert (10, '') in diff['added']
    assert (11, '    if (imgURL == null)') in diff['added']
    assert (12, '    {') in diff['added']
    assert (14, '        return null;') in diff['added']
    assert (16, '    else') in diff['added']
    assert (17, '        return new ImageIcon(imgURL);') in diff['added']
github ishepard / pydriller / tests / test_repository_mining.py View on Github external
def test_ignore_add_whitespaces():
    commit = list(RepositoryMining('test-repos/test14',
                                   single="338a74ceae164784e216555d930210371279ba8e").traverse_commits())[0]
    assert len(commit.modifications) == 1
    commit = list(RepositoryMining('test-repos/test14',
                                   skip_whitespaces=True,
                                   single="338a74ceae164784e216555d930210371279ba8e").traverse_commits())[0]
    assert len(commit.modifications) == 0
github ishepard / pydriller / tests / test_repository_mining.py View on Github external
def test_badly_formatted_url():
    with pytest.raises(Exception):
        list(RepositoryMining(
            path_to_repo='https://github.com/ishepard.git/test')
             .traverse_commits())

    with pytest.raises(Exception):
        list(RepositoryMining(path_to_repo='test').traverse_commits())
github ishepard / pydriller / tests / test_repository_mining.py View on Github external
def test_ignore_add_whitespaces_and_modified_normal_line():
    gr = GitRepository('test-repos/test14')
    commit = list(RepositoryMining('test-repos/test14',
                                   single="52716ef1f11e07308b5df1b313aec5496d5e91ce").traverse_commits())[0]
    assert len(commit.modifications) == 1
    parsed_normal_diff = gr.parse_diff(commit.modifications[0].diff)
    commit = list(RepositoryMining('test-repos/test14',
                                   skip_whitespaces=True,
                                   single="52716ef1f11e07308b5df1b313aec5496d5e91ce").traverse_commits())[0]
    assert len(commit.modifications) == 1
    parsed_wo_whitespaces_diff = gr.parse_diff(commit.modifications[0].diff)
    assert len(parsed_normal_diff['added']) == 2
    assert len(parsed_wo_whitespaces_diff['added']) == 1

    assert len(parsed_normal_diff['deleted']) == 1
    assert len(parsed_wo_whitespaces_diff['deleted']) == 0
github ishepard / pydriller / tests / test_repository_mining.py View on Github external
def test_simple_remote_url():
    dt2 = datetime(2018, 10, 20)
    assert len(list(RepositoryMining(
        path_to_repo="https://github.com/ishepard/pydriller.git",
        to=dt2).traverse_commits())) == 159