Commit c878ba60 authored by anatoly techtonik's avatar anatoly techtonik Committed by Commit Bot

git map: Add -h option

Bug:

Change-Id: Ife7f4049062bc951e58d5c322b1fc7e39338fe79
Reviewed-on: https://chromium-review.googlesource.com/463246
Commit-Queue: anatoly techtonik <techtonik@gmail.com>
Reviewed-by: 's avatarRobbie Iannucci <iannucci@chromium.org>
parent bf3dd5a8
......@@ -4,8 +4,9 @@
# found in the LICENSE file.
"""
Provides an augmented `git log --graph` view. In particular, it also annotates
commits with branches + tags that point to them. Items are colorized as follows:
Enhances `git log --graph` view with information on commit branches + tags that
point to them. Items are colorized as follows:
* Cyan - Currently checked out branch
* Green - Local branch
* Red - Remote branches
......@@ -37,7 +38,33 @@ RESET = colorama.Fore.RESET + colorama.Back.RESET + colorama.Style.RESET_ALL
# Git emits combined color
BRIGHT_RED = '\x1b[1;31m'
def print_help():
names = {
'Cyan': CYAN,
'Green': GREEN,
'Magenta': MAGENTA,
'Red': RED,
'White': WHITE,
'Blue background': BLUEBAK,
}
msg = "usage: git map [-h] [<args>]\n"
for line in __doc__.splitlines():
for key in names.keys():
if key in line:
msg += line.replace('* ', '* ' + names[key])+RESET+'\n'
break
else:
msg += line + '\n'
sys.stdout.write(msg)
def main(argv):
if '-h' in argv:
print_help()
return 0
map_extra = get_config_list('depot_tools.map_extra')
fmt = '%C(red bold)%h%x09%Creset%C(green)%d%Creset %C(yellow)%ad%Creset ~ %s'
log_proc = subprocess2.Popen(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment