Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Unified Diff: git_map.py

Issue 2157763002: git map: Add -h, --help option (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools@master
Patch Set: git processes --help itself to show web page Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_map.py
diff --git a/git_map.py b/git_map.py
index 22e02e74b6f411e223eeb54f5608e9af24fed3ec..c765753a020eea3cb9ab11ce46f0c795d9f8e0eb 100755
--- a/git_map.py
+++ b/git_map.py
@@ -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(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698