Exemple #1
0
def registerWorkstation(uuid):
    fetchListRef(hideErrors=True)
    
    if not checkWorkstationsListRef():
        workstations = uuid
    else:
        workstations = run("git cat-file -p " + workstationsListRef())
        if uuid in workstations:
            return
        workstations = workstations + "\n" + uuid
            
    listSha = popenCommunicate("git hash-object -w --stdin", workstations)
    updateRef(workstationsListRef(), listSha, quiet=True)
Exemple #2
0
def __processesMac():
    processes = list()
    results = run("pgrep -fl -- " + autosaveScriptFile)

    for line in results.splitlines():
        pid = line.split(" ")[0]
        directory = unknownAutosaveDir
        components = line.split(autosaveDirSeparator)
        if len(components) >= 1:
            directory = components[-1]
        processes.append(AutosaveProcess(pid, directory))

    return processes
Exemple #3
0
def metaDict(sha):
    metaJson = run("git cat-file -p " + sha)
    return json.loads(metaJson)
Exemple #4
0
def getFromConfig(setting):
    return run("git config " + setting)
Exemple #5
0
def mainDir():
    return run('git rev-parse --show-toplevel'
               ) + "/"  #TODO: Change to path separator related to os or remove
Exemple #6
0
def createStateTree():
    env = os.environ.copy()
    env["GIT_INDEX_FILE"] = ".git/" + gasIndex
    call("git add .", env)
    return run("git write-tree", env=env)
Exemple #7
0
def treeItems(sha):
    listing = run("git ls-tree " + sha).splitlines()
    iterator = map(str.rstrip, listing)
    return list(iterator)
Exemple #8
0
def checkWorkstationsListRef():
    listRef = run("git rev-parse --verify --quiet " + workstationsListRef())
    return True if listRef else False
Exemple #9
0
def workstationsBlob():
    return run("git rev-parse " +  workstationsListRef())
Exemple #10
0
def workstationsRefs():
    workstations = run("git cat-file -p " + workstationsListRef())
    refs = list()
    for workstation in workstations.splitlines():
        refs.append(workstationRef(workstation))
    return refs