No more inifinite loops, please.
See https://github.com/fedora-infra/fedmsg/pull/326
This commit is contained in:
parent
521db28636
commit
6f3ac61b96
1 changed files with 9 additions and 14 deletions
|
@ -26,19 +26,15 @@ config['active'] = True
|
||||||
config['endpoints']['relay_inbound'] = config['relay_inbound']
|
config['endpoints']['relay_inbound'] = config['relay_inbound']
|
||||||
fedmsg.init(name='relay_inbound', cert_prefix='scm', **config)
|
fedmsg.init(name='relay_inbound', cert_prefix='scm', **config)
|
||||||
|
|
||||||
def revs_between(head, ancestors):
|
def revs_between(head, base):
|
||||||
""" Yield revisions between HEAD and any of the ancestors. """
|
""" Yield revisions between HEAD and BASE. """
|
||||||
|
|
||||||
# For each of my parents
|
# XXX REALLY, just yield head.
|
||||||
for parent in head.parents:
|
# We used to try to navigate the git history and return all the commits in
|
||||||
# If it is not one of the known ancestors
|
# between, but we got into infinite loops more than once because git.
|
||||||
if not parent.id in ancestors:
|
# We could shell out to 'git rev-list head...base', but I'm just not ready
|
||||||
# Then yield all of its history, meeting the same conditions
|
# to do that yet.
|
||||||
for rev in revs_between(parent, ancestors):
|
yield head.id
|
||||||
yield rev
|
|
||||||
|
|
||||||
if not head.id in ancestors:
|
|
||||||
yield head.id
|
|
||||||
|
|
||||||
|
|
||||||
def build_stats(commit):
|
def build_stats(commit):
|
||||||
|
@ -81,8 +77,7 @@ for line in lines:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
base = repo.revparse_single(base)
|
base = repo.revparse_single(base)
|
||||||
ancestors = [commit.id for commit in repo.walk(base.id)]
|
revs = revs_between(head, base)
|
||||||
revs = revs_between(head, ancestors)
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
revs = [head.id]
|
revs = [head.id]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue