From e973f90146c37b2b4ab9eb02e47c4bf3c09b7f5e Mon Sep 17 00:00:00 2001 From: Giulio Vian Date: Mon, 7 Jan 2019 08:31:55 +0000 Subject: [PATCH 1/4] Fixes bug #25 --- src/aggregator-ruleng/Tracker.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/aggregator-ruleng/Tracker.cs b/src/aggregator-ruleng/Tracker.cs index d0db263a..4d7beb88 100644 --- a/src/aggregator-ruleng/Tracker.cs +++ b/src/aggregator-ruleng/Tracker.cs @@ -79,15 +79,25 @@ internal IList LoadWorkItems( .Select(id => new PermanentWorkItemId(id)) .GroupBy(k => tracked.ContainsKey(k)) .ToDictionary(g => g.Key, g => g.ToList()); + // groups[true] is the set of IDs already tracked + // groups[false] is the set of new IDs var inMemory = tracked .Where(w => groups.ContainsKey(true) ? groups[true].Contains(w.Key) : false) .Select(w => w.Value.Current); - var loaded = loader(groups[false].Select(k => k.Value)); - return inMemory.Union(loaded).ToList(); + if (groups.ContainsKey(false)) + { + var loaded = loader(groups[false].Select(k => k.Value)); + + return inMemory.Union(loaded).ToList(); + } + else + { + return inMemory.ToList(); + } } internal bool IsTracked(WorkItemWrapper workItemWrapper) From 7832bb7ab813a7c7b22a9642be9e0be911bcc3f4 Mon Sep 17 00:00:00 2001 From: Giulio Vian Date: Sat, 2 Feb 2019 18:58:14 +0000 Subject: [PATCH 2/4] Batch file to run aggregator --- src/aggregator-cli/aggregator-cli.cmd | 17 +++++++++++++++++ src/aggregator-cli/aggregator-cli.csproj | 3 +++ 2 files changed, 20 insertions(+) create mode 100644 src/aggregator-cli/aggregator-cli.cmd diff --git a/src/aggregator-cli/aggregator-cli.cmd b/src/aggregator-cli/aggregator-cli.cmd new file mode 100644 index 00000000..18304002 --- /dev/null +++ b/src/aggregator-cli/aggregator-cli.cmd @@ -0,0 +1,17 @@ +@echo off +REM Search if .Net Core installed +where /Q dotnet +IF %ERRORLEVEL% NEQ 0 ( + echo .Net Core Runtime is missing, please install from https://dotnet.microsoft.com/download + goto bye +) +REM Check .Net Core version +FOR /f "delims=-" %%i IN ('dotnet --version') DO SET _DOTNETVER=%%i +IF q%_DOTNETVER:2.1=%==q%_DOTNETVER% ( + echo Another version of .Net Core Runtime is installed, please install version 2.1 from https://dotnet.microsoft.com/download + goto bye +) +REM All good run aggregator forwarding any parameter +dotnet %~dp0aggregator-cli.dll %* + +:bye \ No newline at end of file diff --git a/src/aggregator-cli/aggregator-cli.csproj b/src/aggregator-cli/aggregator-cli.csproj index 89003634..96f13831 100644 --- a/src/aggregator-cli/aggregator-cli.csproj +++ b/src/aggregator-cli/aggregator-cli.csproj @@ -48,6 +48,9 @@ + + PreserveNewest + PreserveNewest From 2257e7904f9dbba9b2dd06b08c1741e6c32cac9c Mon Sep 17 00:00:00 2001 From: Giulio Vian Date: Sat, 2 Feb 2019 18:58:37 +0000 Subject: [PATCH 3/4] Additional example that updates a wi --- src/aggregator-cli/test/test5.rule | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/aggregator-cli/test/test5.rule diff --git a/src/aggregator-cli/test/test5.rule b/src/aggregator-cli/test/test5.rule new file mode 100644 index 00000000..7057c621 --- /dev/null +++ b/src/aggregator-cli/test/test5.rule @@ -0,0 +1,9 @@ +.language=Csharp + +if (self.Description.EndsWith(".")) { + self.Description = self.Description.TrimEnd('.'); + return "."; +} else { + return "no ."; +} + From 9e9b68240b54021ef95b3c4e5695eaebf9c045c7 Mon Sep 17 00:00:00 2001 From: Giulio Vian Date: Sun, 3 Feb 2019 10:26:03 +0000 Subject: [PATCH 4/4] Updated doc with CMD --- README.md | 2 +- doc/command-examples.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f2fdc6ef..6d76e065 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ If you go this route, remember add the `--resourceGroup` to all commands requiri Download and unzip the latest CLI.zip file from [Releases](https://github.com/tfsaggregator/aggregator-cli/releases). It requires [.Net Core 2.1](https://www.microsoft.com/net/download) installed on the machine. -To run Aggregator use `dotnet aggregator-cli.dll` followed by a verb and its options. +To run Aggregator run `aggregator-cli` or `dotnet aggregator-cli.dll` followed by a verb and its options. ### Verbs diff --git a/doc/command-examples.md b/doc/command-examples.md index 50714ac2..64252d12 100644 --- a/doc/command-examples.md +++ b/doc/command-examples.md @@ -1,7 +1,7 @@ # Sample Aggregator CLI usage In the following you will find many sample usage of Aggregator CLI commands. -Run `dotnet aggregator-cli.dll` followed by the command and any option. +Run `aggregator-cli` or `dotnet aggregator-cli.dll` followed by the command and any option. All commands accept the `--verbose` option to print additional messages, useful in troubleshooting.