Skip to content

Commit

Permalink
Fix unpredicatable behavior of delete-unmanaged + failing builds on PPA
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelLipski committed Jan 6, 2020
1 parent f3d53e4 commit af9e6fc
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 29 deletions.
5 changes: 5 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions ci/apt-ppa/upload-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions debian/source/options
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion git_machete/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.12.7'
__version__ = '2.12.8'
4 changes: 2 additions & 2 deletions git_machete/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
11 changes: 0 additions & 11 deletions git_machete/tests/functional/correct_output.txt

This file was deleted.

37 changes: 26 additions & 11 deletions git_machete/tests/functional/test_machete.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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()
Expand All @@ -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)

0 comments on commit af9e6fc

Please sign in to comment.