def allIds(): """ Return a generator which yields IDs of all log records. """ dataDir = XmlStorage.dataDir cmd = ["find", dataDir, "-name", ".git", "-prune", "-o", "-type", "f", "-print0"] res = applib.get_status_byte_output(cmd) if not res[0]: print("find command failed:", file=sys.stderr) print(res[2].decode(), file=sys.stderr, end="") return lines = res[1].split(b"\x00")[:-1] # remove the last empty one for path in lines: yield os.path.basename(path.decode())
def allIds(): """ Return a generator which yields IDs of all log records. """ dataDir = XmlStorage.dataDir cmd = ['find', dataDir, '-name', '.git', '-prune', '-o', '-type', 'f', '-print0'] res = applib.get_status_byte_output(cmd) if not res[0]: print('find command failed:', file=sys.stderr) print(res[2].decode(), file=sys.stderr, end='') return lines = res[1].split(b'\x00')[:-1] # remove the last empty one for path in lines: yield os.path.basename(path.decode())
def runCmd(self, cmd, quiet=False): """ Switch the working directory to the GIT_DIR, then run git command there, and then switch back. """ owd = os.getcwd() os.chdir(self.gitWorkTree) res = applib.get_status_byte_output(cmd) if not res[0] and not quiet: msg = 'git command failed:' if res[1]: msg += ('\n' + res[1].decode()) if res[2]: msg += ('\n' + res[2].decode()) print(msg, file=sys.stderr, end='') os.chdir(owd) return res
def allIds(): """ Return a generator which yields IDs of all log records. """ dataDir = XmlStorage.dataDir cmd = [ 'find', dataDir, '-name', '.git', '-prune', '-o', '-type', 'f', '-print0' ] res = applib.get_status_byte_output(cmd) if not res[0]: print('find command failed:', file=sys.stderr) print(res[2].decode(), file=sys.stderr, end='') return lines = res[1].split(b'\x00')[:-1] # remove the last empty one for path in lines: yield os.path.basename(path.decode())