Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions bin/git-bc-show-eligible
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env python
# coding=utf-8

from __future__ import unicode_literals

import subprocess
import argparse
Expand Down Expand Up @@ -96,10 +99,37 @@ if sys.stdout.isatty():
author_format_str = ' \033[31m| %s <%s>\033[0m'
commit_format_str = '\033[33m%s\033[0m %s%s'

seen = ''
groups = []
current_group = []
for commit in find_unpicked(repo, from_commit, to_commit, since_commit, args.all):
author_info = ''
if args.all:
author_info = author_format_str % (commit.author.name, commit.author.email)

print(commit_format_str % (str(commit.id), commit.message[:commit.message.index('\n')],
author_info))
commit_msg = commit.message[:commit.message.index('\n')]
indent = commit_msg in seen
seen += commit.message

commit_string = (commit_format_str % (str(commit.id), commit_msg, author_info))

if indent:
current_group.append(commit_string)
else:
if current_group:
groups.append(current_group)
current_group = [commit_string]

for group in groups:
merge = group[0]
child_commits = group[1:-1]
last_child_commit = group[-1] if len(group) > 1 else ''

print(merge)

for child in child_commits:
print(" ├─ {}".format(child))

if last_child_commit:
print(" └─ {}".format(last_child_commit))