From 5fcce09e02b8a20090f09c5449d3c05946f19fc0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 1 Dec 2025 20:54:48 +0000 Subject: [PATCH 1/5] Initial plan From 9255f5db2151405abe053c4c9f509b30debdf834 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 1 Dec 2025 21:01:12 +0000 Subject: [PATCH 2/5] Add deprecation warning for bzr support Co-authored-by: mattfarina <62991+mattfarina@users.noreply.github.com> --- bzr.go | 3 +++ bzr_test.go | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/bzr.go b/bzr.go index 9803d20..e2829d0 100644 --- a/bzr.go +++ b/bzr.go @@ -16,6 +16,9 @@ var bzrDetectURL = regexp.MustCompile("parent branch: (?P.+)\n") // NewBzrRepo creates a new instance of BzrRepo. The remote and local directories // need to be passed in. func NewBzrRepo(remote, local string) (*BzrRepo, error) { + // Log deprecation warning + Logger.Println("WARNING: Bazaar (bzr) is deprecated and no longer maintained. Support for bzr may be removed in a future version.") + ins := depInstalled("bzr") if !ins { return nil, NewLocalError("bzr is not installed", nil, "") diff --git a/bzr_test.go b/bzr_test.go index 9a5d82b..1221795 100644 --- a/bzr_test.go +++ b/bzr_test.go @@ -1,16 +1,64 @@ package vcs import ( + "bytes" + "io/ioutil" + "log" "os" "path/filepath" + "strings" "testing" "time" - //"log" ) // Canary test to ensure BzrRepo implements the Repo interface. var _ Repo = &BzrRepo{} +// TestBzrDeprecationWarning tests that a deprecation warning is logged when creating a BzrRepo +func TestBzrDeprecationWarning(t *testing.T) { + tempDir, err := ioutil.TempDir("", "go-vcs-bzr-tests") + if err != nil { + t.Error(err) + } + defer func() { + err = os.RemoveAll(tempDir) + if err != nil { + t.Error(err) + } + }() + + // Create a custom logger to capture output + var buf bytes.Buffer + customLogger := log.New(&buf, "", 0) + + // Save original logger and restore it after test + originalLogger := Logger + defer func() { + Logger = originalLogger + }() + + // Set custom logger + Logger = customLogger + + // Create a BzrRepo instance - this may fail if bzr is not installed, + // but the warning should still be logged before that check + _, err = NewBzrRepo("https://launchpad.net/govcstestbzrrepo", tempDir+"/test") + // We don't check the error here because bzr might not be installed, + // but the warning should still be logged + + // Check if deprecation warning was logged + output := buf.String() + if !strings.Contains(output, "WARNING") { + t.Error("Expected WARNING in log output, got:", output) + } + if !strings.Contains(output, "Bazaar") || !strings.Contains(output, "bzr") { + t.Error("Expected deprecation message to mention Bazaar or bzr, got:", output) + } + if !strings.Contains(output, "deprecated") { + t.Error("Expected deprecation message to contain 'deprecated', got:", output) + } +} + // To verify bzr is working we perform integration testing // with a known bzr service. Due to the long time of repeatedly checking out // repos these tests are structured to work together. From c5c1132b151eeb912db4d5d9fb7274e4f3bdab9e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 1 Dec 2025 21:02:31 +0000 Subject: [PATCH 3/5] Improve test assertions for bzr deprecation warning Co-authored-by: mattfarina <62991+mattfarina@users.noreply.github.com> --- bzr_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bzr_test.go b/bzr_test.go index 1221795..aeff5ee 100644 --- a/bzr_test.go +++ b/bzr_test.go @@ -51,8 +51,11 @@ func TestBzrDeprecationWarning(t *testing.T) { if !strings.Contains(output, "WARNING") { t.Error("Expected WARNING in log output, got:", output) } - if !strings.Contains(output, "Bazaar") || !strings.Contains(output, "bzr") { - t.Error("Expected deprecation message to mention Bazaar or bzr, got:", output) + if !strings.Contains(output, "Bazaar") { + t.Error("Expected deprecation message to mention Bazaar, got:", output) + } + if !strings.Contains(output, "bzr") { + t.Error("Expected deprecation message to mention bzr, got:", output) } if !strings.Contains(output, "deprecated") { t.Error("Expected deprecation message to contain 'deprecated', got:", output) From 79604964d9adc932a82f9481515044906146af99 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Tue, 2 Dec 2025 12:25:14 -0500 Subject: [PATCH 4/5] Removing ioutil (deprecated package) Signed-off-by: Matt Farina --- bzr_test.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/bzr_test.go b/bzr_test.go index aeff5ee..4599e51 100644 --- a/bzr_test.go +++ b/bzr_test.go @@ -2,7 +2,6 @@ package vcs import ( "bytes" - "io/ioutil" "log" "os" "path/filepath" @@ -16,16 +15,7 @@ var _ Repo = &BzrRepo{} // TestBzrDeprecationWarning tests that a deprecation warning is logged when creating a BzrRepo func TestBzrDeprecationWarning(t *testing.T) { - tempDir, err := ioutil.TempDir("", "go-vcs-bzr-tests") - if err != nil { - t.Error(err) - } - defer func() { - err = os.RemoveAll(tempDir) - if err != nil { - t.Error(err) - } - }() + tempDir := t.TempDir() // Create a custom logger to capture output var buf bytes.Buffer @@ -42,7 +32,7 @@ func TestBzrDeprecationWarning(t *testing.T) { // Create a BzrRepo instance - this may fail if bzr is not installed, // but the warning should still be logged before that check - _, err = NewBzrRepo("https://launchpad.net/govcstestbzrrepo", tempDir+"/test") + _, _ = NewBzrRepo("https://launchpad.net/govcstestbzrrepo", tempDir+"/test") // We don't check the error here because bzr might not be installed, // but the warning should still be logged From 9890c5fcddc8e70ece91ee6e9fa6fe044491dd45 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Tue, 2 Dec 2025 12:51:40 -0500 Subject: [PATCH 5/5] Cleaning up warning message Signed-off-by: Matt Farina --- bzr.go | 2 +- bzr_test.go | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/bzr.go b/bzr.go index e2829d0..5c9f1ce 100644 --- a/bzr.go +++ b/bzr.go @@ -17,7 +17,7 @@ var bzrDetectURL = regexp.MustCompile("parent branch: (?P.+)\n") // need to be passed in. func NewBzrRepo(remote, local string) (*BzrRepo, error) { // Log deprecation warning - Logger.Println("WARNING: Bazaar (bzr) is deprecated and no longer maintained. Support for bzr may be removed in a future version.") + Logger.Println("WARNING: The Bazaar (bzr) project has been retired and is no longer maintained. Support for bzr may be removed in a future version.") ins := depInstalled("bzr") if !ins { diff --git a/bzr_test.go b/bzr_test.go index 4599e51..13c0bfd 100644 --- a/bzr_test.go +++ b/bzr_test.go @@ -38,18 +38,9 @@ func TestBzrDeprecationWarning(t *testing.T) { // Check if deprecation warning was logged output := buf.String() - if !strings.Contains(output, "WARNING") { + if !strings.Contains(output, "WARNING: The Bazaar (bzr) project has been retired and is no longer maintained. Support for bzr may be removed in a future version.") { t.Error("Expected WARNING in log output, got:", output) } - if !strings.Contains(output, "Bazaar") { - t.Error("Expected deprecation message to mention Bazaar, got:", output) - } - if !strings.Contains(output, "bzr") { - t.Error("Expected deprecation message to mention bzr, got:", output) - } - if !strings.Contains(output, "deprecated") { - t.Error("Expected deprecation message to contain 'deprecated', got:", output) - } } // To verify bzr is working we perform integration testing