Skip to content

Commit

Permalink
visdep: add -short-labels support
Browse files Browse the repository at this point in the history
  • Loading branch information
Ross Younger committed Nov 2, 2017
1 parent b086d65 commit ee122b5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions sandbox/visdep.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
Omits the checkout nodes from the graph. This is recommended
in most cases.
-s[hort-labels] Uses short node labels. This makes the graph easier to read,
but can cause confusion in some cases.
-f[ilter] <name> Tell xdot.py to use the named graphviz filter (one of
dot, neato, twopi, circo or fdp). The default is dot.
Expand All @@ -49,7 +52,7 @@
import sys

def process(labels, reduce=False, filter='dot', keep_files=False,
verbose=False, outputfile=None, hideCheckouts=False):
verbose=False, outputfile=None, hideCheckouts=False, shortLabels=False):

# The first program we want to run is in the sandbox with us
thisdir = os.path.split(__file__)[0]
Expand All @@ -68,6 +71,8 @@ def process(labels, reduce=False, filter='dot', keep_files=False,
labels2 = []
if hideCheckouts:
labels2.append('--hide-checkouts')
if shortLabels:
labels2.append('--short-labels')
for label in labels:
labels2.append("'%s'"%label)
retcode = subprocess.call('%s %s'%(visualiser, ' '.join(labels2)),
Expand Down Expand Up @@ -144,6 +149,7 @@ def main(args):
labels = []
outputfile = None
hideCheckouts = False
shortLabels = False

while args:
word = args.pop(0)
Expand All @@ -163,13 +169,15 @@ def main(args):
args = args[1:]
elif word in ('-c', '-hide-checkouts'):
hideCheckouts = True
elif word in ('-s', '-short-labels'):
shortLabels = True
elif word[0] == '-':
print 'Unrecognised switch', word
return
else:
labels.append(word)

process(labels, reduce, filter, keep_files, verbose, outputfile, hideCheckouts)
process(labels, reduce, filter, keep_files, verbose, outputfile, hideCheckouts, shortLabels)
return 0

if __name__ == '__main__':
Expand Down

0 comments on commit ee122b5

Please sign in to comment.