diff --git a/centpkg-warn-on-possible-fork.patch b/centpkg-warn-on-possible-fork.patch new file mode 100644 index 0000000..2a467e7 --- /dev/null +++ b/centpkg-warn-on-possible-fork.patch @@ -0,0 +1,52 @@ +From 46d7daa5bfecde9344dd48ed5c04a3681553340c Mon Sep 17 00:00:00 2001 +From: Troy Dawson +Date: Tue, 23 Apr 2024 14:50:41 -0700 +Subject: [PATCH] warn on possible fork + +--- + src/centpkg/__init__.py | 3 ++- + tests/test_distgit.py | 6 +++--- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/centpkg/__init__.py b/src/centpkg/__init__.py +index d52b659..782f107 100644 +--- a/src/centpkg/__init__.py ++++ b/src/centpkg/__init__.py +@@ -92,7 +92,8 @@ class DistGitDirectory(object): + DeprecationWarning) + else: + if not self.is_fork(): +- raise ValueError("Branchname: {0} is not valid".format(branchtext)) ++ warnings.warn('Unable to determine if this is a fork or not. Proceeding, but you should double check.', ++ UserWarning) + else: + self.distrobranch = True + self.signame = 'centos' +diff --git a/tests/test_distgit.py b/tests/test_distgit.py +index 5519a78..257aa13 100644 +--- a/tests/test_distgit.py ++++ b/tests/test_distgit.py +@@ -13,11 +13,11 @@ class TestDistGitNothing(unittest.TestCase): + with self.assertRaises(TypeError): + d = DistGitDirectory() + +-class TestDistGitInvalid(unittest.TestCase): ++class TestDistGitInvalid(unittest.TestCase, CatchWarningsMixin): + def test_invalid_branchstring_raises(self): + self.branchstring = 'nope-not-a-branch' + +- with self.assertRaises(ValueError): ++ with self.assertWarns(UserWarning): + self.d = DistGitDirectory(self.branchstring) + + class TestDistgitOnlySig(unittest.TestCase): +@@ -244,4 +244,4 @@ class TestIsFork(unittest.TestCase): + @unittest.mock.patch.object(centpkg_git.repo.Repo, '__init__', new=lambda s, p: None) + def test_upstream_url(self): + d = DistGitDirectory(self.branchstring, 'binutils') +- self.assertFalse(d.is_fork()) +\ No newline at end of file ++ self.assertFalse(d.is_fork()) +-- +2.39.3 + diff --git a/centpkg.spec b/centpkg.spec index 4d04b5f..0aee870 100644 --- a/centpkg.spec +++ b/centpkg.spec @@ -5,12 +5,14 @@ Name: centpkg Version: 0.8.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: CentOS utility for working with dist-git License: GPL-2.0-or-later URL: https://git.centos.org/centos/centpkg Source0: %{url}/archive/%{version}/centpkg-%{version}.tar.gz BuildArch: noarch +# https://git.centos.org/centos/centpkg/issue/93 +Patch1: centpkg-warn-on-possible-fork.patch BuildRequires: python3-devel BuildRequires: python3-setuptools @@ -78,6 +80,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} %{python3} -m unittest discover --verb %changelog +* Tue Apr 23 2024 Troy Dawson - 0.8.3-2 +- Warn (not Fail) on possible fork when pushing (Issue: 93) + * Fri Mar 15 2024 Troy Dawson - 0.8.3-1 - Update branch detection for c10s