示例#1
0
def tracked_files(*args):
    """Return the names of all files in the repository"""
    out = git.ls_files('--', *args, z=True)[STDOUT]
    if out:
        return sorted(out[:-1].split('\0'))
    else:
        return []
示例#2
0
def diff_worktree(paths=None):
    modified = []
    submodules = set()

    if paths is None:
        paths = []
    filter_paths = ['--'] + paths
    status, out, err = git.diff_files(z=True, *filter_paths)
    if status != 0:
        # handle git init
        out = git.ls_files(modified=True, z=True)[STDOUT]
        if out:
            modified = out[:-1].split('\0')
        return modified, submodules

    while out:
        rest, out = out.split('\0', 1)
        name, out = out.split('\0', 1)
        status = rest[-1]
        if '160000' in rest[1:14]:
            submodules.add(name)
        elif status in 'DAMT':
            modified.append(name)

    return modified, submodules
示例#3
0
def all_files():
    """Return the names of all files in the repository"""
    out = git.ls_files(z=True)[STDOUT]
    if out:
        return out[:-1].split('\0')
    else:
        return []
示例#4
0
def all_files():
    """Returns a sorted list of all files, including untracked files."""
    ls_files = git.ls_files(z=True,
                            cached=True,
                            others=True,
                            exclude_standard=True)[STDOUT]
    return sorted([f for f in ls_files.split('\0') if f])
示例#5
0
def all_files():
    """Return the names of all files in the repository"""
    ls_files = git.ls_files(z=True)
    if ls_files:
        return core.decode(ls_files[:-1]).split('\0')
    else:
        return []
示例#6
0
def tracked_files(*args):
    """Return the names of all files in the repository"""
    out = git.ls_files('--', *args, z=True)[STDOUT]
    if out:
        return sorted(out[:-1].split('\0'))
    else:
        return []
示例#7
0
def all_files():
    """Returns a sorted list of all files, including untracked files."""
    ls_files = git.ls_files(z=True,
                            cached=True,
                            others=True,
                            exclude_standard=True)[STDOUT]
    return sorted([f for f in ls_files.split('\0') if f])
示例#8
0
def diff_worktree(paths=None):
    modified = []
    submodules = set()

    if paths is None:
        paths = []
    filter_paths = ['--'] + paths
    status, out, err = git.diff_files(z=True, *filter_paths)
    if status != 0:
        # handle git init
        out = git.ls_files(modified=True, z=True)[STDOUT]
        if out:
            modified = out[:-1].split('\0')
        return modified, submodules

    while out:
        rest, out = out.split('\0', 1)
        name, out = out.split('\0', 1)
        status = rest[-1]
        if '160000' in rest[1:14]:
            submodules.add(name)
        elif status in 'DAMT':
            modified.append(name)

    return modified, submodules
示例#9
0
def all_files():
    """Return the names of all files in the repository"""
    ls_files = git.ls_files(z=True)
    if ls_files:
        return core.decode(ls_files[:-1]).split('\0')
    else:
        return []
示例#10
0
def all_files():
    """Return the names of all files in the repository"""
    out = git.ls_files(z=True)[STDOUT]
    if out:
        return out[:-1].split("\0")
    else:
        return []
示例#11
0
def untracked_files(git=git, paths=None):
    """Returns a sorted list of untracked files."""

    if paths is None:
        paths = []
    args = ['--'] + paths
    out = git.ls_files(z=True, others=True, exclude_standard=True,
                       *args)[STDOUT]
    if out:
        return out[:-1].split('\0')
    return []
示例#12
0
def untracked_files(git=git, paths=None):
    """Returns a sorted list of untracked files."""

    if paths is None:
        paths = []
    args = ['--'] + paths
    out = git.ls_files(z=True, others=True, exclude_standard=True,
                       *args)[STDOUT]
    if out:
        return out[:-1].split('\0')
    return []
示例#13
0
def diff_worktree():
    modified = []
    submodules = set()

    status, out, err = git.diff_files(z=True)
    if status != 0:
        # handle git init
        out = git.ls_files(modified=True, z=True)[STDOUT]
        if out:
            modified = out[:-1].split("\0")
        return modified, submodules

    while out:
        rest, out = out.split("\0", 1)
        name, out = out.split("\0", 1)
        status = rest[-1]
        if "160000" in rest[1:14]:
            submodules.add(name)
        elif status in "DAMT":
            modified.append(name)

    return modified, submodules
示例#14
0
def diff_worktree():
    modified = []
    submodules = set()

    status, output = git.diff_files(z=True, with_status=True)
    if status != 0:
        # handle git init
        ls_files = core.decode(git.ls_files(modified=True, z=True))
        if ls_files:
            modified = ls_files[:-1].split('\0')
        return modified, submodules

    while output:
        rest, output = output.split('\0', 1)
        name, output = output.split('\0', 1)
        status = rest[-1]
        name = core.decode(name)
        if '160000' in rest[1:14]:
            submodules.add(name)
        elif status in 'DAMT':
            modified.append(name)

    return modified, submodules
示例#15
0
def diff_worktree():
    modified = []
    submodules = set()

    status, output = git.diff_files(z=True, with_status=True)
    if status != 0:
        # handle git init
        ls_files = core.decode(git.ls_files(modified=True, z=True))
        if ls_files:
            modified = ls_files[:-1].split('\0')
        return modified, submodules

    while output:
        rest, output = output.split('\0', 1)
        name, output = output.split('\0', 1)
        status = rest[-1]
        name = core.decode(name)
        if '160000' in rest[1:14]:
            submodules.add(name)
        elif status in 'DAMT':
            modified.append(name)

    return modified, submodules
示例#16
0
def diff_worktree():
    modified = []
    submodules = set()

    output = git.diff_files(z=True, with_stderr=True)
    if output.startswith("fatal:"):
        # handle git init
        ls_files = core.decode(git.ls_files(modified=True, z=True))
        if ls_files:
            modified = ls_files[:-1].split("\0")
        return modified, submodules

    while output:
        rest, output = output.split("\0", 1)
        name, output = output.split("\0", 1)
        status = rest[-1]
        name = core.decode(name)
        if "160000" in rest[1:14]:
            submodules.add(name)
        elif status in "DAMT":
            modified.append(name)

    return modified, submodules
示例#17
0
def untracked_files(git=git):
    """Returns a sorted list of untracked files."""
    ls_files = git.ls_files(z=True, others=True, exclude_standard=True)
    if ls_files:
        return core.decode(ls_files[:-1]).split('\0')
    return []
示例#18
0
def untracked_files(git=git):
    """Returns a sorted list of untracked files."""
    out = git.ls_files(z=True, others=True, exclude_standard=True)[STDOUT]
    if out:
        return out[:-1].split("\0")
    return []
示例#19
0
def untracked_files(git=git):
    """Returns a sorted list of untracked files."""
    ls_files = git.ls_files(z=True, others=True, exclude_standard=True)
    if ls_files:
        return core.decode(ls_files[:-1]).split('\0')
    return []
示例#20
0
def untracked_files(git=git):
    """Returns a sorted list of untracked files."""
    out = git.ls_files(z=True, others=True, exclude_standard=True)[STDOUT]
    if out:
        return out[:-1].split('\0')
    return []