Support dormant branches in the git map-branches output.
This adds support in two ways:
1. Displays a "(dormant)" marker as part of each branch's line when the
verbosity level is four or above. ('git bmap -v -v -v -v ...'). It's
worth noting that, with verbosity level 4, each line is now 119
characters long; verbosity level 3 is 107.
2. Enables callers to hide dormant branches using a new '--hide-dormant'
option. If the dormant branch is the parent of non-dormant branches,
it's still shown, despite being dormant, so that it can continue to
serve as the parent line for non-dormant branches.
Change-Id: I0504419fd12357563288b5d53bc49ca68a876e8f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4654849
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Orr Bernstein <orrb@google.com>
diff --git a/git_common.py b/git_common.py
index 7fe6c05..8309225 100644
--- a/git_common.py
+++ b/git_common.py
@@ -821,12 +821,13 @@
autostrip = kwargs.pop('autostrip', True)
indata = kwargs.pop('indata', None)
decode = kwargs.pop('decode', True)
+ accepted_retcodes = kwargs.pop('accepted_retcodes', [0])
cmd = (GIT_EXE, '-c', 'color.ui=never') + cmd
proc = subprocess2.Popen(cmd, **kwargs)
ret, err = proc.communicate(indata)
retcode = proc.wait()
- if retcode != 0:
+ if retcode not in accepted_retcodes:
raise subprocess2.CalledProcessError(retcode, cmd, os.getcwd(), ret, err)
if autostrip: