Exemplo n.º 1
0
def test_ls():
    with fleeting_repo() as test_repo:
        test_repo.commit([('test_proj/test.txt', 'testing\n'),
                          ('test_proj/test2.txt', 'testing\n'),
                          ('test3.txt', 'testing\n')])
        git_root = test_repo.repo_root
        test_proj_root = os.path.join(git_root, 'test_proj')
        # ls on the sub-dir project should not include test3.
        eq_(sorted([os.path.join(test_proj_root, f)
                    for f
                    in ('test.txt', 'test2.txt')]),
            project.ls(test_proj_root))
        # ls on the sub-dir project should include test3.
        eq_(sorted([os.path.join(test_proj_root, f)
                    for f
                    in ('test.txt', 'test2.txt')] +
                   [os.path.join(git_root, 'test3.txt')]),
            project.ls(git_root))
Exemplo n.º 2
0
def _interesting_fnames_in_proj(project_dir, interesting_fnames_res,
                                boring_fnames_res):
    """
    Return a list of the interesting fnames in the project dir, using
    the logic of interesting.is_interesting_fname.
    """
    interesting_fnames = []

    for fname in project.ls(project_dir):
        rel_fname = util.rel_fname(project_dir, fname)
        if is_interesting_fname(rel_fname, interesting_fnames_res,
                                boring_fnames_res):
            interesting_fnames.append(fname)
        else:
            log.info("Skipping fname %s, not interesting" % fname)

    return interesting_fnames
Exemplo n.º 3
0
def _interesting_fnames_in_proj(project_dir, interesting_fnames_res,
                                boring_fnames_res):
    """
    Return a list of the interesting fnames in the project dir, using
    the logic of interesting.is_interesting_fname.
    """
    interesting_fnames = []

    for fname in project.ls(project_dir):
        rel_fname = util.rel_fname(project_dir, fname)
        if is_interesting_fname(rel_fname,
                                interesting_fnames_res,
                                boring_fnames_res):
            interesting_fnames.append(fname)
        else:
            log.info("Skipping fname %s, not interesting" % fname)

    return interesting_fnames
Exemplo n.º 4
0
def test_ls_barfs_on_non_git_repo():
    with util.mk_tmpdir() as temp_dir:
        project.ls(temp_dir)