File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,21 +47,23 @@ for REPO in "${REPOS[@]}"; do
4747 REPO_NAME=$( basename " $REPO " )
4848 REPO=$( cd " $REPO " && pwd)
4949
50- cd " $REPO " || continue
50+ (
51+ cd " $REPO " || exit 1
5152
52- MODE=" full"
53- FLAGS=" "
54- if [ -f " graphify-out/graph.json" ]; then
55- MODE=" incremental"
56- FLAGS=" --update"
57- fi
53+ MODE=" full"
54+ FLAGS=" "
55+ if [ -f " graphify-out/graph.json" ]; then
56+ MODE=" incremental"
57+ FLAGS=" --update"
58+ fi
5859
59- echo " $( date -Iseconds) START: $REPO_NAME ($MODE )" >> " $LOG "
60+ echo " $( date -Iseconds) START: $REPO_NAME ($MODE )" >> " $LOG "
6061
61- if " $GRAPHIFY " . $FLAGS >> " $LOG " 2>&1 ; then
62- SIZE=$( du -sh graphify-out/graph.json 2> /dev/null | cut -f1)
63- echo " $( date -Iseconds) OK: $REPO_NAME graph.json ($SIZE )" >> " $LOG "
64- else
65- echo " $( date -Iseconds) ERROR: $REPO_NAME graphify failed" >> " $LOG "
66- fi
62+ if " $GRAPHIFY " . $FLAGS >> " $LOG " 2>&1 ; then
63+ SIZE=$( du -sh graphify-out/graph.json 2> /dev/null | cut -f1)
64+ echo " $( date -Iseconds) OK: $REPO_NAME graph.json ($SIZE )" >> " $LOG "
65+ else
66+ echo " $( date -Iseconds) ERROR: $REPO_NAME graphify failed" >> " $LOG "
67+ fi
68+ )
6769done
Original file line number Diff line number Diff line change @@ -38,15 +38,17 @@ for REPO in "${REPOS[@]}"; do
3838 REPO_NAME=$( basename " $REPO " )
3939 echo " === Graphify: $REPO_NAME ==="
4040
41- cd " $REPO " || continue
42- " $GRAPHIFY " . 2>&1 | tail -5
43-
44- if [ -f " graphify-out/graph.json" ]; then
45- SIZE=$( du -sh graphify-out/graph.json | cut -f1)
46- echo " OK: graph.json ($SIZE )"
47- else
48- echo " ERROR: No graph.json generated"
49- fi
41+ (
42+ cd " $REPO " || exit 1
43+ " $GRAPHIFY " . 2>&1 | tail -5
44+
45+ if [ -f " graphify-out/graph.json" ]; then
46+ SIZE=$( du -sh graphify-out/graph.json | cut -f1)
47+ echo " OK: graph.json ($SIZE )"
48+ else
49+ echo " ERROR: No graph.json generated"
50+ fi
51+ )
5052 echo " "
5153done
5254
Original file line number Diff line number Diff line change 55set -uo pipefail
66
77DEPTH=2
8- while [[ $# -gt 1 ]]; do
9- case " ${2:- } " in
10- --depth) DEPTH=" ${3:- 2} " ; shift 2 ;;
11- * ) break ;;
8+ TARGET=" "
9+ POSITIONAL=()
10+ while [[ $# -gt 0 ]]; do
11+ case " $1 " in
12+ --depth) DEPTH=" ${2:- 2} " ; shift 2 ;;
13+ --diff) TARGET=" --diff" ; shift ;;
14+ * ) POSITIONAL+=(" $1 " ); shift ;;
1215 esac
1316done
17+ set -- " ${POSITIONAL[@]+" ${POSITIONAL[@]} " } "
1418
1519resolve_graph () {
1620 local filepath=" $1 "
@@ -113,7 +117,7 @@ if high_impact:
113117PYEOF
114118}
115119
116- if [ -n " ${1:- } " ] && [ " $1 " != " --diff" ]; then
120+ if [ -n " ${1:- } " ] && [ " $TARGET " != " --diff" ]; then
117121 repo=$( resolve_graph " $1 " )
118122 if [ $? -ne 0 ]; then
119123 echo " No graphify graph found for $1 "
Original file line number Diff line number Diff line change @@ -18,23 +18,26 @@ if [ ${#REPOS[@]} -eq 0 ]; then
1818 fi
1919fi
2020
21- REPO_ARGS= " "
21+ VALID_REPOS=()
2222for REPO in " ${REPOS[@]} " ; do
23- [ -f " $REPO /graphify-out/graph.json" ] && REPO_ARGS= " $REPO_ARGS $ REPO"
23+ [ -f " $REPO /graphify-out/graph.json" ] && VALID_REPOS+=( " $ REPO" )
2424done
2525
26- if [ -z " $REPO_ARGS " ]; then
26+ if [ ${ # VALID_REPOS[@]} -eq 0 ]; then
2727 echo " No repos with graphify-out/graph.json found"
2828 exit 1
2929fi
3030
31+ export _MERGE_REPOS
32+ _MERGE_REPOS=$( IFS=' :' ; echo " ${VALID_REPOS[*]} " )
33+
3134python3 << 'PYEOF '
32- import json, sys, os
35+ import json, os
3336from pathlib import Path
3437from collections import defaultdict
3538
36- repos = sys.argv[1:] if len(sys.argv) > 1 else os.environ.get("GRAPHIFY_REPOS ", "").split(":")
37- repos = [r for r in repos if r and Path(r).joinpath("graphify-out/graph.json").exists()]
39+ repos = [r for r in os.environ.get("_MERGE_REPOS ", "").split(":") if r]
40+ repos = [r for r in repos if Path(r).joinpath("graphify-out/graph.json").exists()]
3841out_dir = os.environ.get("GRAPHIFY_SYSTEM_DIR", "./system-graph")
3942
4043all_nodes = []
You can’t perform that action at this time.
0 commit comments