~mdw
/
stgit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Optimise the Commit objects creation
[stgit]
/
stgit
/
git.py
diff --git
a/stgit/git.py
b/stgit/git.py
index
9d8cdf0
..
c1c20c7
100644
(file)
--- a/
stgit/git.py
+++ b/
stgit/git.py
@@
-75,10
+75,23
@@
class Commit:
def get_committer(self):
return self.__committer
def get_committer(self):
return self.__committer
+# dictionary of Commit objects, used to avoid multiple calls to git
+__commits = dict()
#
# Functions
#
#
# Functions
#
+def get_commit(id_hash):
+ """Commit objects factory. Save/look-up them in the __commits
+ dictionary
+ """
+ if id_hash in __commits:
+ return __commits[id_hash]
+ else:
+ commit = Commit(id_hash)
+ __commits[id_hash] = commit
+ return commit
+
def get_conflicts():
"""Return the list of file conflicts
"""
def get_conflicts():
"""Return the list of file conflicts
"""