X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/e4f41f5d393b5f1e83a39a42a5f204efb6ef7ea6..8e29bcd2fd67066143b88de8829130c6af043e2f:/stgit/git.py diff --git a/stgit/git.py b/stgit/git.py index 9d8cdf0..c1c20c7 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -75,10 +75,23 @@ class Commit: def get_committer(self): return self.__committer +# dictionary of Commit objects, used to avoid multiple calls to git +__commits = dict() # # 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 """