def __init__(self, repo, commitid, treeid, parent, message, authorname, authordate, commitername, commiterdate): Commitish.__init__(self, repo, commitid) self.repo = repo self.commitid = commitid self.treeid = treeid self.parent = parent or NULL_ID self.message = message self.authorname = authorname self.authordate = authordate self.commitername = commitername self.commiterdate = commiterdate
def __init__(self, repo, commitid, treeid, parents, message, authorname, authordate, committername, committerdate): Commitish.__init__(self, repo, commitid) self.repo = repo self.commitid = commitid self.treeid = treeid self._parents = parents or [NULL_ID] self.message = message self.authorname = authorname self.authordate = authordate self.committername = committername self.committerdate = committerdate
def head(self): self.checkisrepo() headfile = os.path.join(self.repo.url, '.geogig', 'HEAD') with codecs.open(headfile, 'r', 'utf-8') as f: line = f.readline() ref = line.strip().split()[-1] if ref.startswith("refs/heads/"): ref = ref[len("refs/heads/"):] return Commitish(self.repo, ref)
def commonancestor(self, refa, refb): commands = ["merge-base", refa, refb] try: output = self.run(commands) return Commitish(self.repo, output[0].strip()) except GeoGigException, e: if "No common ancestor" in e.args[0]: return None else: raise e
def fromref(repo, ref): ''' Returns a Commit corresponding to a given id. ref is passed as a string. ''' if ref == NULL_ID: return Commitish(repo, NULL_ID) else: if (repo.url, ref) not in Commit._commitcache: id = repo.revparse(ref) log = repo.log(id, n = 1) Commit._commitcache[(repo.url, ref)] = log[0] return Commit._commitcache[(repo.url, ref)]
def master(self): '''Returns a Commitish representing the master branch''' return Commitish(self, geogig.MASTER)
def workingtree(self): '''Returns a Commitish representing workingtree''' return Commitish(self, geogig.WORK_HEAD)
def index(self): '''Returns a Commitish representing the index''' return Commitish(self, geogig.STAGE_HEAD)