Skip to content

Commit cd3f049

Browse files
committed
Merge branch 'master' of https://github.com/tonybaloney/wily
2 parents 03fdd99 + 6ff89ef commit cd3f049

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/wily/commands/graph.py

+13-7
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ def graph(
4848

4949
data = []
5050
state = State(config)
51-
abs_path = config.path / pathlib.Path(path)
5251

5352
if x_axis is None:
5453
x_axis = "history"
@@ -58,12 +57,17 @@ def graph(
5857
y_metric = resolve_metric(metrics[0])
5958
title = f"{x_axis.capitalize()} of {y_metric.description} for {path}{' aggregated' if aggregate else ''}"
6059

61-
if abs_path.is_dir() and not aggregate:
62-
paths = [
63-
p.relative_to(config.path) for p in pathlib.Path(abs_path).glob("**/*.py")
64-
]
60+
if not aggregate:
61+
tracked_files = set()
62+
for rev in state.index[state.default_archiver].revisions:
63+
tracked_files.update(rev.revision.tracked_files)
64+
paths = {
65+
tracked_file
66+
for tracked_file in tracked_files
67+
if tracked_file.startswith(path)
68+
} or {path}
6569
else:
66-
paths = [path]
70+
paths = {path}
6771

6872
operator, key = metric_parts(metrics[0])
6973
if len(metrics) == 1: # only y-axis
@@ -104,7 +108,9 @@ def graph(
104108
x_key,
105109
)
106110
)
107-
labels.append(f"{rev.revision.author_name} <br>{rev.revision.message}")
111+
labels.append(
112+
f"{rev.revision.author_name} <br>{rev.revision.message}"
113+
)
108114
last_y = val
109115
except KeyError:
110116
# missing data

0 commit comments

Comments
 (0)