From af9e6fc828a25a3918d1a6c4a311d8943c6b9d4f Mon Sep 17 00:00:00 2001 From: Pawel Lipski Date: Mon, 6 Jan 2020 20:31:09 +0100 Subject: [PATCH] Fix unpredicatable behavior of delete-unmanaged + failing builds on PPA --- RELEASE_NOTES.md | 5 +++ ci/apt-ppa/upload-entrypoint.sh | 4 +- debian/source/options | 2 - git_machete/__init__.py | 2 +- git_machete/cmd.py | 4 +- .../tests/functional/correct_output.txt | 11 ------ git_machete/tests/functional/test_machete.py | 37 +++++++++++++------ 7 files changed, 36 insertions(+), 29 deletions(-) delete mode 100644 git_machete/tests/functional/correct_output.txt diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 0feac1985..28c515f8a 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,5 +1,10 @@ # Release notes +## New in git-machete 2.12.8 + +- fixed: unpredictable behavior of `delete-unmanaged` +- fixed: build of Debian packages on PPA + ## New in git-machete 2.12.7 - improved: logging output of external commands in `--debug` mode diff --git a/ci/apt-ppa/upload-entrypoint.sh b/ci/apt-ppa/upload-entrypoint.sh index 726216073..66112c417 100644 --- a/ci/apt-ppa/upload-entrypoint.sh +++ b/ci/apt-ppa/upload-entrypoint.sh @@ -18,8 +18,8 @@ VERSION=$(cut -d\' -f2 git_machete/__init__.py) export VERSION envsubst '$VERSION' < debian/files.envsubst > debian/files cp LICENSE debian/copyright -# The first version ever released to PPA is 2.12.7, so we skip everything older than that from the changelog. -sed '/## New in git-machete 2\.12\.6/,$d' RELEASE_NOTES.md | awk -f ~/release-notes-to-changelog.awk > debian/changelog +# The first version ever released to PPA is 2.12.8, so we skip everything older than that from the changelog. +sed '/## New in git-machete 2\.12\.7/,$d' RELEASE_NOTES.md | awk -f ~/release-notes-to-changelog.awk > debian/changelog # Since we upload over SFTP, we need to whitelist the host first to avoid the prompt. ssh-keyscan ppa.launchpad.net > ~/.ssh/known_hosts diff --git a/debian/source/options b/debian/source/options index 59d70db5e..b27e14638 100644 --- a/debian/source/options +++ b/debian/source/options @@ -3,9 +3,7 @@ tar-ignore = build tar-ignore = ChangeLog tar-ignore = ci tar-ignore = completion -tar-ignore = deb_dist tar-ignore = dist -tar-ignore = .dockerignore tar-ignore = *.egg-info tar-ignore = .eggs tar-ignore = *.envsubst diff --git a/git_machete/__init__.py b/git_machete/__init__.py index 8725fd382..72819bcf6 100644 --- a/git_machete/__init__.py +++ b/git_machete/__init__.py @@ -1 +1 @@ -__version__ = '2.12.7' +__version__ = '2.12.8' diff --git a/git_machete/cmd.py b/git_machete/cmd.py index 073d763e0..7efb9d2e8 100644 --- a/git_machete/cmd.py +++ b/git_machete/cmd.py @@ -708,10 +708,10 @@ def load_branches(): def merged_local_branches(): - return map( + return list(map( lambda b: re.sub("^refs/heads/", "", b), non_empty_lines(popen_git("for-each-ref", "--format=%(refname)", "--merged", "HEAD", "refs/heads")) - ) + )) def go(branch): diff --git a/git_machete/tests/functional/correct_output.txt b/git_machete/tests/functional/correct_output.txt deleted file mode 100644 index 6c30a5dda..000000000 --- a/git_machete/tests/functional/correct_output.txt +++ /dev/null @@ -1,11 +0,0 @@ - develop - | - x-allow-ownership-link PR #123 (ahead of origin) - | | - | x-build-chain PR #124 (untracked) - | - o-call-ws (ahead of origin) - - master - | - o-hotfix/add-trigger * (diverged from origin) diff --git a/git_machete/tests/functional/test_machete.py b/git_machete/tests/functional/test_machete.py index a6eca9845..e47405f47 100644 --- a/git_machete/tests/functional/test_machete.py +++ b/git_machete/tests/functional/test_machete.py @@ -1,10 +1,11 @@ -import sys -import string -import random +import io import os +import random +import re +import string +import sys import textwrap import unittest -from io import StringIO from git_machete import cmd @@ -93,7 +94,7 @@ def setup_sandbox(self): definition_file.writelines(textwrap.dedent(machete_string)) os.system('git branch -d root') - out = StringIO() + out = io.StringIO() sys.stdout = out cmd.launch(['git-machete', 'status']) return out.getvalue() @@ -102,12 +103,26 @@ def setup_sandbox(self): Setup = SandboxSetup() +def adapt(s): + return re.sub(r"\|\n", "| \n", s[1:]) + + +expected_output = adapt(""" + develop + | + x-allow-ownership-link PR #123 (ahead of origin) + | | + | x-build-chain PR #124 (untracked) + | + o-call-ws (ahead of origin) + + master + | + o-hotfix/add-trigger * (diverged from origin) +""") + + class MacheteTester(unittest.TestCase): def test_machete(self): - self.file_directory = os.path.dirname(os.path.abspath(__file__)) - self.correct_output = os.path.join( - self.file_directory, 'correct_output.txt') - with open(self.correct_output) as f: - self.content = f.read() - self.assertEqual(Setup.setup_sandbox(), self.content) + self.assertEqual(Setup.setup_sandbox(), expected_output)