Skip to content

Commit 17b5d38

Browse files
committed
devtools: show pull and commit information in github-merge
Print the number and title of the pull, as well as the commits to be merged.
1 parent fc08994 commit 17b5d38

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

contrib/devtools/github-merge.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@
2424
GIT = os.getenv('GIT','git')
2525
BASH = os.getenv('BASH','bash')
2626

27+
# OS specific configuration for terminal attributes
28+
ATTR_RESET = ''
29+
ATTR_PR = ''
30+
COMMIT_FORMAT = '%h %s (%an)%d'
31+
if os.name == 'posix': # if posix, assume we can use basic terminal escapes
32+
ATTR_RESET = '\033[0m'
33+
ATTR_PR = '\033[1;36m'
34+
COMMIT_FORMAT = '%C(bold blue)%h%Creset %s %C(cyan)(%an)%Creset%C(green)%d%Creset'
35+
2736
def git_config_get(option, default=None):
2837
'''
2938
Get named configuration option from git repository.
@@ -150,6 +159,9 @@ def main():
150159
print("ERROR: Creating merge failed (already merged?).",file=stderr)
151160
exit(4)
152161

162+
print('%s#%s%s %s' % (ATTR_RESET+ATTR_PR,pull,ATTR_RESET,title))
163+
subprocess.check_call([GIT,'log','--graph','--topo-order','--pretty=format:'+COMMIT_FORMAT,base_branch+'..'+head_branch])
164+
print()
153165
# Run test command if configured.
154166
if testcmd:
155167
# Go up to the repository's root.

0 commit comments

Comments
 (0)