Skip to content

Commit

Permalink
Merge pull request #398 from git-big-picture/more-deterministic-graph…
Browse files Browse the repository at this point in the history
…viz-output

More deterministic Graphviz output
  • Loading branch information
hartwork committed Mar 8, 2024
2 parents 0abdbd3 + 325c7e0 commit 6a4537a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions git_big_picture/_main.py
Expand Up @@ -1036,7 +1036,7 @@ def label_gen():
if history_direction is not None:
rankdir = RANKDIR_OF_HISTORY_DIRECTION[history_direction]
dot_file_lines.append(f'\trankdir="{rankdir}";')
for sha_one, labels, color in label_gen():
for sha_one, labels, color in sorted(label_gen()):
label = '\\n'.join(labels + ((with_commit_messages or sha_ones_on_labels) and [
format_label(sha_one),
] or list()))
Expand All @@ -1051,7 +1051,7 @@ def label_gen():
sha_label = format_label(sha_one)
dot_file_lines.append(f'\t"{sha_one}"[label="{sha_label}"];')
for child, self.parents in self.parents.items():
for p in self.parents:
for p in sorted(self.parents):
dot_file_lines.append(f'\t"{child}" -> "{p}";')
dot_file_lines.append('}')
return dot_file_lines
Expand Down
16 changes: 16 additions & 0 deletions run-tests-with-coverage.sh
Expand Up @@ -68,6 +68,22 @@ except ImportError:
pass
SITECUSTOMIZE_PY_EOF

# Run smoke-test for determinism with real Git history;
# these modes are opposites of FILTER_DEFAULTS in _main.py .
for mode in \
--all \
--no-branches \
--no-tags \
--no-roots \
--merges \
--bifurcations \
--commit-messages \
; do
git-big-picture --graphviz "${mode}" "${source_dir}" > 1.dot
git-big-picture --graphviz "${mode}" "${source_dir}" > 2.dot
diff -U 0 1.dot 2.dot # i.e. fail if there is any diff
rm 1.dot 2.dot
done

# Actually run the tests
exit_code=0
Expand Down

0 comments on commit 6a4537a

Please sign in to comment.