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