aboutsummaryrefslogtreecommitdiff
blob: 7016717cb292dfba75ab1e14077a774ee1e2aa0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""
Filesystem utils
"""
import os

def strip_prefix(string, prefix):
    """Returns a string, stripped from its prefix"""
    if string.startswith(prefix):
        return string[len(prefix):]
    else:
        return string

def remove_file(repo, dst):
    """
    Removes a file from a repository (adding changes to the index)
    Parameters:
        repo - the repo
        dst - the file
    """
    repo.index.remove(dst)
    os.remove(dst)