|
@@ -3,8 +3,7 @@
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
# found in the LICENSE file.
|
|
|
|
|
|
-"""Provides a short mapping of all the branches in your local repo, organized
|
|
|
|
-by their upstream ('tracking branch') layout.
|
|
|
|
|
|
+"""Print dependency tree of branches in local repo.
|
|
|
|
|
|
Example:
|
|
Example:
|
|
origin/master
|
|
origin/master
|
|
@@ -278,6 +277,19 @@ class BranchMapper(object):
|
|
self.__append_branch(child, depth=depth + 1)
|
|
self.__append_branch(child, depth=depth + 1)
|
|
|
|
|
|
|
|
|
|
|
|
+def print_desc():
|
|
|
|
+ for line in __doc__.splitlines():
|
|
|
|
+ starpos = line.find('* ')
|
|
|
|
+ if starpos == -1 or '-' not in line:
|
|
|
|
+ print(line)
|
|
|
|
+ else:
|
|
|
|
+ _, color, rest = line.split(None, 2)
|
|
|
|
+ outline = line[:starpos+1]
|
|
|
|
+ outline += getattr(Fore, color.upper()) + " " + color + " " + Fore.RESET
|
|
|
|
+ outline += rest
|
|
|
|
+ print(outline)
|
|
|
|
+ print('')
|
|
|
|
+
|
|
def main(argv):
|
|
def main(argv):
|
|
setup_color.init()
|
|
setup_color.init()
|
|
if get_git_version() < MIN_UPSTREAM_TRACK_GIT_VERSION:
|
|
if get_git_version() < MIN_UPSTREAM_TRACK_GIT_VERSION:
|
|
@@ -287,8 +299,10 @@ def main(argv):
|
|
'.'.join(str(x) for x in MIN_UPSTREAM_TRACK_GIT_VERSION) +
|
|
'.'.join(str(x) for x in MIN_UPSTREAM_TRACK_GIT_VERSION) +
|
|
'. Please consider upgrading.')
|
|
'. Please consider upgrading.')
|
|
|
|
|
|
- parser = argparse.ArgumentParser(
|
|
|
|
- description='Print a a tree of all branches parented by their upstreams')
|
|
|
|
|
|
+ if '-h' in argv:
|
|
|
|
+ print_desc()
|
|
|
|
+
|
|
|
|
+ parser = argparse.ArgumentParser()
|
|
parser.add_argument('-v', action='count',
|
|
parser.add_argument('-v', action='count',
|
|
help='Display branch hash and Rietveld URL')
|
|
help='Display branch hash and Rietveld URL')
|
|
parser.add_argument('--no-color', action='store_true', dest='nocolor',
|
|
parser.add_argument('--no-color', action='store_true', dest='nocolor',
|