diff options
author | Ralph Bean <rbean@redhat.com> | 2015-02-23 16:59:56 +0000 |
---|---|---|
committer | Ralph Bean <rbean@redhat.com> | 2015-02-23 17:00:04 +0000 |
commit | c72f37a112f6dd09010d5d28b59e7391429b61bd (patch) | |
tree | f66285d31300e2a7eb784ad7bff5e07173964e1c | |
parent | 293207d03b371b73db9fd6e362802f1e0157bfec (diff) | |
download | ansible-c72f37a112f6dd09010d5d28b59e7391429b61bd.tar.gz ansible-c72f37a112f6dd09010d5d28b59e7391429b61bd.tar.xz ansible-c72f37a112f6dd09010d5d28b59e7391429b61bd.zip |
Avoid recursively expanding the entire git history.
-rw-r--r-- | roles/git/hooks/files/post-receive-fedmsg | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/roles/git/hooks/files/post-receive-fedmsg b/roles/git/hooks/files/post-receive-fedmsg index 0276c9932..ae618882c 100644 --- a/roles/git/hooks/files/post-receive-fedmsg +++ b/roles/git/hooks/files/post-receive-fedmsg @@ -41,22 +41,6 @@ def revs_between(head, ancestors): yield head.id -def gather_ancestors(commit, seen=None): - """ Yield all ancestors commits of a given commit. """ - - seen = seen or [] - idx = commit.id - - if not idx in seen: - seen.append(idx) - - for parent in commit.parents: - for revid in gather_ancestors(parent, seen=seen): - yield revid - - yield idx - - def build_stats(commit): files = defaultdict(lambda: defaultdict(int)) @@ -97,7 +81,7 @@ for line in lines: try: base = repo.revparse_single(base) - ancestors = list(gather_ancestors(base)) + ancestors = [commit.id for commit in repo.walk(base.id)] revs = revs_between(head, ancestors) except KeyError: revs = [head.id] |