From 9f974e5d41815fafc7cddaa29a9c3a6f175d1670 Mon Sep 17 00:00:00 2001 From: Thomas Rooijakkers Date: Fri, 3 Dec 2021 11:46:16 +0100 Subject: [PATCH 1/5] Add support for deleted files in graph --- src/wily/commands/graph.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/wily/commands/graph.py b/src/wily/commands/graph.py index 9682100e..b0b0573b 100644 --- a/src/wily/commands/graph.py +++ b/src/wily/commands/graph.py @@ -58,12 +58,18 @@ def graph( y_metric = resolve_metric(metrics[0]) title = f"{x_axis.capitalize()} of {y_metric.description} for {path}{' aggregated' if aggregate else ''}" - if abs_path.is_dir() and not aggregate: - paths = [ - p.relative_to(config.path) for p in pathlib.Path(abs_path).glob("**/*.py") - ] + if not aggregate: + tracked_files = set() + for rev in state.index[state.default_archiver].revisions: + tracked_files.update(rev.revision.tracked_files) + print(tracked_files) + paths = { + tracked_file + for tracked_file in tracked_files + if tracked_file.startswith(path) + } else: - paths = [path] + paths = {path} operator, key = metric_parts(metrics[0]) if len(metrics) == 1: # only y-axis @@ -104,7 +110,9 @@ def graph( x_key, ) ) - labels.append(f"{rev.revision.author_name}
{rev.revision.message}") + labels.append( + f"{rev.revision.author_name}
{rev.revision.message}" + ) last_y = val except KeyError: # missing data From eb425b6136865ef8c082342a579ab98959961d30 Mon Sep 17 00:00:00 2001 From: Thomas Rooijakkers Date: Fri, 3 Dec 2021 13:27:51 +0100 Subject: [PATCH 2/5] Remove print --- src/wily/commands/graph.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/wily/commands/graph.py b/src/wily/commands/graph.py index b0b0573b..7aaab9fb 100644 --- a/src/wily/commands/graph.py +++ b/src/wily/commands/graph.py @@ -62,7 +62,6 @@ def graph( tracked_files = set() for rev in state.index[state.default_archiver].revisions: tracked_files.update(rev.revision.tracked_files) - print(tracked_files) paths = { tracked_file for tracked_file in tracked_files From 1b1dfea1c5fe936ed74af765091742f07e857f8b Mon Sep 17 00:00:00 2001 From: Thomas Rooijakkers Date: Fri, 19 Aug 2022 10:54:49 +0200 Subject: [PATCH 3/5] Resolve failing test due to merge of master --- src/wily/commands/graph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wily/commands/graph.py b/src/wily/commands/graph.py index 7aaab9fb..4403136a 100644 --- a/src/wily/commands/graph.py +++ b/src/wily/commands/graph.py @@ -58,7 +58,7 @@ def graph( y_metric = resolve_metric(metrics[0]) title = f"{x_axis.capitalize()} of {y_metric.description} for {path}{' aggregated' if aggregate else ''}" - if not aggregate: + if abs_path.is_dir() and not aggregate: tracked_files = set() for rev in state.index[state.default_archiver].revisions: tracked_files.update(rev.revision.tracked_files) From a59665fc292a3eb66092749627dc62fe37542b96 Mon Sep 17 00:00:00 2001 From: Thomas Rooijakkers Date: Fri, 19 Aug 2022 11:16:29 +0200 Subject: [PATCH 4/5] Ensure that we can still view removed dirs --- src/wily/commands/graph.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wily/commands/graph.py b/src/wily/commands/graph.py index 4403136a..4d8f6247 100644 --- a/src/wily/commands/graph.py +++ b/src/wily/commands/graph.py @@ -48,7 +48,6 @@ def graph( data = [] state = State(config) - abs_path = config.path / pathlib.Path(path) if x_axis is None: x_axis = "history" @@ -58,7 +57,7 @@ def graph( y_metric = resolve_metric(metrics[0]) title = f"{x_axis.capitalize()} of {y_metric.description} for {path}{' aggregated' if aggregate else ''}" - if abs_path.is_dir() and not aggregate: + if ":" not in path and not aggregate: tracked_files = set() for rev in state.index[state.default_archiver].revisions: tracked_files.update(rev.revision.tracked_files) From cc45c525cb7437dca99707f61625d282c50e1b3d Mon Sep 17 00:00:00 2001 From: Thomas Rooijakkers Date: Fri, 19 Aug 2022 11:42:20 +0200 Subject: [PATCH 5/5] More elegant solution to support ':' in macOS paths.. --- src/wily/commands/graph.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wily/commands/graph.py b/src/wily/commands/graph.py index 4d8f6247..df217de0 100644 --- a/src/wily/commands/graph.py +++ b/src/wily/commands/graph.py @@ -57,7 +57,7 @@ def graph( y_metric = resolve_metric(metrics[0]) title = f"{x_axis.capitalize()} of {y_metric.description} for {path}{' aggregated' if aggregate else ''}" - if ":" not in path and not aggregate: + if not aggregate: tracked_files = set() for rev in state.index[state.default_archiver].revisions: tracked_files.update(rev.revision.tracked_files) @@ -65,7 +65,7 @@ def graph( tracked_file for tracked_file in tracked_files if tracked_file.startswith(path) - } + } or {path} else: paths = {path}