From: Catalin Marinas Date: Wed, 28 May 2008 21:02:01 +0000 (+0100) Subject: Refactor the Commitdata class to CommitData X-Git-Tag: v0.15-rc1~224 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/f5f22afe39694a687b67077e1789600dc9ff47c9 Refactor the Commitdata class to CommitData Signed-off-by: Catalin Marinas --- diff --git a/stgit/commands/coalesce.py b/stgit/commands/coalesce.py index 412968a..1a34934 100644 --- a/stgit/commands/coalesce.py +++ b/stgit/commands/coalesce.py @@ -42,7 +42,7 @@ class SaveTemplateDone(Exception): def _coalesce_patches(trans, patches, msg, save_template): cd = trans.patches[patches[0]].data - cd = git.Commitdata(tree = cd.tree, parents = cd.parents) + cd = git.CommitData(tree = cd.tree, parents = cd.parents) for pn in patches[1:]: c = trans.patches[pn] tree = trans.stack.repository.simple_merge( diff --git a/stgit/commands/new.py b/stgit/commands/new.py index bfa7b6c..15bb2e0 100644 --- a/stgit/commands/new.py +++ b/stgit/commands/new.py @@ -59,7 +59,7 @@ def func(parser, options, args): parser.error('incorrect number of arguments') head = directory.repository.refs.get(directory.repository.head) - cd = gitlib.Commitdata( + cd = gitlib.CommitData( tree = head.data.tree, parents = [head], message = '', author = gitlib.Person.author(), committer = gitlib.Person.committer()) diff --git a/stgit/lib/git.py b/stgit/lib/git.py index f046e12..b3181cb 100644 --- a/stgit/lib/git.py +++ b/stgit/lib/git.py @@ -154,7 +154,7 @@ class Tree(Repr): def __str__(self): return 'Tree<%s>' % self.sha1 -class Commitdata(Repr): +class CommitData(Repr): """Immutable.""" def __init__(self, tree = NoValue, parents = NoValue, author = NoValue, committer = NoValue, message = NoValue, defaults = NoValue): @@ -199,7 +199,7 @@ class Commitdata(Repr): parents = None else: parents = [p.sha1 for p in self.parents] - return ('Commitdata' ) % (tree, parents, self.author, self.committer, self.message) @classmethod @@ -233,7 +233,7 @@ class Commit(Repr): @property def data(self): if self.__data == None: - self.__data = Commitdata.parse( + self.__data = CommitData.parse( self.__repository, self.__repository.cat_object(self.sha1)) return self.__data diff --git a/stgit/lib/stack.py b/stgit/lib/stack.py index af1c994..5876a3e 100644 --- a/stgit/lib/stack.py +++ b/stgit/lib/stack.py @@ -32,7 +32,7 @@ class Patch(object): old_log = [self.__stack.repository.refs.get(self.__log_ref)] except KeyError: old_log = [] - cd = git.Commitdata(tree = new_commit.data.tree, parents = old_log, + cd = git.CommitData(tree = new_commit.data.tree, parents = old_log, message = '%s\t%s' % (msg, new_commit.sha1)) c = self.__stack.repository.commit(cd) self.__stack.repository.refs.set(self.__log_ref, c, msg)