Skip to content

Better Windows support #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Rebase

on:
workflow_dispatch:
schedule:
- cron: '0 */12 * * *'

jobs:
rebase:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git config user.name "$(git log -1 --pretty=format:'%aN')"
- run: git config user.email "$(git log -1 --pretty=format:'%aE')"
- run: git fetch --prune --unshallow origin +refs/tags/*:refs/tags/*
- run: git fetch https://github.com/stacked-git/stgit.git master
- run: git rebase FETCH_HEAD
- name: Push changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
force: true
22 changes: 12 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,32 @@ install-html:
lint: lint-black lint-isort lint-flake8 lint-t

lint-black:
$(PYTHON) -m black --check --quiet --diff . stg
$(PYTHON) -m black --check --quiet --diff .

lint-isort:
$(PYTHON) -m isort --check-only --quiet --diff . stg
$(PYTHON) -m isort --check-only --quiet --diff .

lint-flake8:
$(PYTHON) -m flake8 . stg
$(PYTHON) -m flake8 .

lint-t:
$(MAKE) -C t test-lint

.PHONY: lint lint-black lint-isort lint-flake8 lint-t

format:
$(PYTHON) -m black . stg
$(PYTHON) -m isort --quiet . stg
$(PYTHON) -m black .
$(PYTHON) -m isort --quiet .

test: build
$(MAKE) -C t all

test-patches:
for patch in $$(stg series --noprefix $(TEST_PATCHES)); do \
stg goto $$patch && $(MAKE) test || break; \
for patch in $$(t/stg series --noprefix $(TEST_PATCHES)); do \
t/stg goto $$patch && $(MAKE) test || break; \
done

.PHONY: format test test-patches
.PHONY: format test test-patches .install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the rule has been removed?


coverage:
$(MAKE) coverage-test
Expand All @@ -71,10 +71,11 @@ coverage-test:
$(MAKE) .coverage

.coverage:
rm -rf build
rm -rf install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is adding this install file? am i missing something?

$(MAKE) build
-mkdir .cov-files
COVERAGE_FILE=$(CURDIR)/.cov-files/.coverage \
$(PYTHON) -m coverage run --context=setup setup.py build
$(PYTHON) -m coverage run --context=setup setup.py install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

COVERAGE_PROCESS_START=$(CURDIR)/pyproject.toml \
COVERAGE_FILE=$(CURDIR)/.cov-files/.coverage \
$(MAKE) -C t all
Expand All @@ -101,6 +102,7 @@ clean:
$(MAKE) -C $$dir clean; \
done
rm -rf build
rm -rf inst
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

install?

rm -rf dist
rm -f stgit/*.pyc
rm -rf stgit/__pycache__
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Stacked Git

[![Build](https://github.com/wildmichael/stgit/actions/workflows/ci.yml/badge.svg)](https://github.com/wildmichael/stgit/actions/workflows/ci.yml)
[![Rebase](https://github.com/wildmichael/stgit/actions/workflows/rebase.yml/badge.svg)](https://github.com/wildmichael/stgit/actions/workflows/rebase.yml)

> ## Note
> This is a fork where I maintain a few modifications to the upstream source.
> Once I consider them to be ready, I'll submit them as pull requests
> for inclusion in the upstream sources.

Stacked Git, **StGit** for short, is an application for managing Git
commits as a stack of patches.

Expand Down
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env python3
import os
import sys
from distutils.core import setup
from glob import glob

from setuptools import setup

from stgit import commands, version
from stgit.completion.bash import write_bash_completion
from stgit.completion.fish import write_fish_completion
Expand Down Expand Up @@ -110,7 +111,9 @@ def __check_git_version():
download_url='https://github.com/stacked-git/stgit.git',
description='Stacked Git',
long_description='Application for managing Git commits as a stack of patches.',
scripts=['stg'],
entry_points={
'console_scripts': ['stg=stgit.main:main'],
},
packages=[
'stgit',
'stgit.commands',
Expand Down
41 changes: 0 additions & 41 deletions stg

This file was deleted.

21 changes: 21 additions & 0 deletions stgit/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,28 @@ def _main():


def main():
import sys

try:
if sys.version_info[:2] < (3, 5):
sys.stderr.write('StGit requires Python >= 3.5\n')
sys.exit(1)

if os.environ.get('COVERAGE_PROCESS_START'):
import coverage

if len(sys.argv) < 2 or sys.argv[1].startswith('-'):
context = 'stg'
else:
context = 'stg-' + sys.argv[1]

cov = coverage.process_startup()
cov.switch_context(context)

_main()
finally:
run.finish_logging()


if __name__ == '__main__':
main()
22 changes: 22 additions & 0 deletions t/stg
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

# This script is only used by the tests so they can work without stgit being
# installed. It assumes PYTHONPATH to be set up correctly.
Comment on lines +1 to +4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to avoid making changes like this to the test infra. The test infra is heavily borrowed from git -- every change we make makes it more difficult to update our infra to match git's. If think is something we think is important the best place to add it might be the git repo itself.

Is this something that's needed for Windows?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for being MIA for so long... Yes, I agree, it is bad. Maybe move it out of t/? As to your question: no, it is more related to setuptool packaging.


CUR_DIR="$(pwd)"
SCRIPT_DIR="$(dirname "$0")"
cd "$SCRIPT_DIR"
SCRIPT_DIR="$(pwd)"
cd "$CUR_DIR"
STGIT_ROOT="$(realpath "$SCRIPT_DIR/..")"

# sanity check
if test ! -f "$STGIT_ROOT/build/lib/stgit/main.py"; then
echo >&2 "error: $STGIT_ROOT/build/lib/stgit/main.py missing (has stg been built?)."
exit 1
fi

PYTHON="${PYTHON:-python}"
export PYTHONPATH="$STGIT_ROOT/build/lib"

"$PYTHON" -m stgit.main "$@"
20 changes: 8 additions & 12 deletions t/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,13 @@ then
fi
STG_ROOT=$(cd "$TEST_DIRECTORY"/.. && pwd) || exit 1
export STG_ROOT
stg_build_dir="$STG_ROOT"/build
PYTHON="${PYTHON:-python}"
python_major_minor="$($PYTHON -c '
import sys
print(".".join(map(str, sys.version_info[:2])))')"
stg_bin_dir="$stg_build_dir"/scripts-"$python_major_minor"
stg_build_dir="$STG_ROOT/build/lib"
stg_t_dir="$STG_ROOT/t"

if test ! -f "$stg_bin_dir"/stg
if test ! -f "$stg_build_dir/stgit/main.py"
then
echo >&2 "error: $stg_bin_dir missing (has stg been built?)."
echo >&2 "error: $stg_build_dir/stgit/main.py missing (has stg been built?)."
exit 1
fi
PERL_PATH=${PERL:-perl}
Expand All @@ -56,8 +53,8 @@ export PERL_PATH SHELL_PATH

################################################################
# It appears that people try to run tests without building...
"${STG_TEST_INSTALLED:-$stg_bin_dir}/stg" 2> /dev/null
if test $? != 1
"${STG_TEST_INSTALLED:-$stg_build_dir/stgit/main.py}" 2> /dev/null
if test ! \( -f "${STG_TEST_INSTALLED}/stg" -o -f "${stg_build_dir}/stgit/main.py" \)
then
if test -n "$STG_TEST_INSTALLED"
then
Expand Down Expand Up @@ -1069,14 +1066,13 @@ if test -n "$STG_TEST_INSTALLED"
then
PATH=$STG_TEST_INSTALLED:$PATH
else
PATH="$stg_bin_dir:$PATH"
PYTHONPATH="$STG_ROOT":"$PYTHONPATH"
PATH=$stg_t_dir:$PATH
fi
GIT_EXEC_PATH=$(git --exec-path) || error "Cannot run git"
unset GIT_TEMPLATE_DIR
GIT_CONFIG_NOSYSTEM=1
GIT_ATTR_NOSYSTEM=1
export PATH GIT_EXEC_PATH PYTHONPATH GIT_CONFIG_NOSYSTEM GIT_ATTR_NOSYSTEM
export PATH GIT_EXEC_PATH GIT_CONFIG_NOSYSTEM GIT_ATTR_NOSYSTEM

if test -z "$GIT_TEST_CMP"
then
Expand Down