text stringlengths 0 828 |
|---|
# detect module and ticket numbers for each commit: |
component = None |
title = message.split('\n')[0] |
try: |
component, title = title.split("":"", 1) |
component = component.strip() |
except ValueError: |
pass # noqa |
paragraphs = [analyse_body_paragraph(p, labels) |
for p in message.split('\n\n')] |
yield { |
'sha1': commit_sha1, |
'component': component, |
'title': title.strip(), |
'tickets': re.findall(r'\s(#\d+)', message), |
'paragraphs': [ |
(label, remove_ticket_directives(message)) |
for label, message in paragraphs |
], |
}" |
1302,"def release(obj, commit='HEAD', components=False): |
""""""Generate release notes."""""" |
options = obj.options |
repository = obj.repository |
try: |
sha = 'oid' |
commits = _pygit2_commits(commit, repository) |
except ImportError: |
try: |
sha = 'hexsha' |
commits = _git_commits(commit, repository) |
except ImportError: |
click.echo('To use this feature, please install pygit2. ' |
'GitPython will also work but is not recommended ' |
'(python <= 2.7 only).', file=sys.stderr) |
return 2 |
messages = OrderedDict([(getattr(c, sha), c.message) for c in commits]) |
for commit_sha1 in amended_commits(messages): |
if commit_sha1 in messages: |
del messages[commit_sha1] |
full_messages = list( |
enrich_git_log_dict(messages, options.get('commit_msg_labels')) |
) |
indent = ' ' if components else '' |
wrapper = textwrap.TextWrapper( |
width=70, |
initial_indent=indent + '- ', |
subsequent_indent=indent + ' ', |
) |
for label, section in options.get('commit_msg_labels'): |
if section is None: |
continue |
bullets = [] |
for commit in full_messages: |
bullets += [ |
{'text': bullet, 'component': commit['component']} |
for lbl, bullet in commit['paragraphs'] |
if lbl == label and bullet is not None |
] |
if len(bullets) > 0: |
click.echo(section) |
click.echo('~' * len(section)) |
click.echo() |
if components: |
def key(cmt): |
return cmt['component'] |
for component, bullets in itertools.groupby( |
sorted(bullets, key=key), key): |
bullets = list(bullets) |
if len(bullets) > 0: |
click.echo('+ {}'.format(component)) |
click.echo() |
for bullet in bullets: |
click.echo(wrapper.fill(bullet['text'])) |
click.echo() |
else: |
for bullet in bullets: |
click.echo(wrapper.fill(bullet['text'])) |
click.echo() |
return 0" |
1303,"def incr(**vars): |
""""""Increments context variables |
"""""" |
for k, v in vars: |
current_context.vars.setdefault(k, 0) |
current_context[k] += v" |
1304,"def set_default_var(**vars): |
""""""Sets context variables using the key/value provided in the options |
"""""" |
for k, v in vars.iteritems(): |
current_context.vars.setdefault(k, v)" |
1305,"def incr_obj(obj, **attrs): |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.