def doGitReset(self, revision = None): command = ["diff"] if revision != None: command.append(revision) lines = self.doPopenGitCmd(command) if lines != None and len(lines) > 0: tmNow = time.localtime() filename = "%04d-%02d%02d-%02d%02d%02d.diff" % (tmNow.tm_year, tmNow.tm_mon, tmNow.tm_mday, tmNow.tm_hour, tmNow.tm_min, tmNow.tm_sec) if not os.path.exists(self.mPathPatch): self.mkdirSafe(self.mPathPatch); file_write_lines(os.path.join(self.mPathPatch, filename), lines) return self.doExecGitCmd(["reset", "--hard"], of = "/dev/null")
def doGitReset(self, revision=None): command = ["diff"] if revision != None: command.append(revision) lines = self.doPopenGitCmd(command) if lines != None and len(lines) > 0: tmNow = time.localtime() filename = "%04d-%02d%02d-%02d%02d%02d.diff" % ( tmNow.tm_year, tmNow.tm_mon, tmNow.tm_mday, tmNow.tm_hour, tmNow.tm_min, tmNow.tm_sec) if not os.path.exists(self.mPathPatch): self.mkdirSafe(self.mPathPatch) file_write_lines(os.path.join(self.mPathPatch, filename), lines) return self.doExecGitCmd(["reset", "--hard"], of="/dev/null")
def save(self, pathname): lines = self.genStructLines() if not lines: return False valLines = self.toStringLines() if not valLines: return False lines.append("") lines.append("static struct %s %s[] = {" % (STRUCT_NAME, ARRAY_NAME)) valLines = ["\t" + line for line in valLines] lines.extend(valLines) lines.append("};") lines.append("") funcLines = self.genFunctionLines() if not funcLines: return False lines.extend(funcLines) lines = [line + "\n" for line in lines] return file_write_lines(pathname, lines)