Refactor the Commitdata class to CommitData
authorCatalin Marinas <catalin.marinas@gmail.com>
Wed, 28 May 2008 21:02:01 +0000 (22:02 +0100)
committerCatalin Marinas <catalin.marinas@gmail.com>
Wed, 28 May 2008 21:02:01 +0000 (22:02 +0100)
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/commands/coalesce.py
stgit/commands/new.py
stgit/lib/git.py
stgit/lib/stack.py

index 412968a..1a34934 100644 (file)
@@ -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(
index bfa7b6c..15bb2e0 100644 (file)
@@ -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())
 
index f046e12..b3181cb 100644 (file)
@@ -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: %s, parents: %s, author: %s,'
+        return ('CommitData<tree: %s, parents: %s, author: %s,'
                 ' committer: %s, message: "%s">'
                 ) % (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
index af1c994..5876a3e 100644 (file)
@@ -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)