-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c280db
commit 2ef6c25
Showing
33 changed files
with
1,793 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
# Python | ||
[*.py] | ||
indent_style = space | ||
indent_size = 4 | ||
max_line_length = 88 | ||
|
||
# YAML | ||
[*.yaml] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# JSON | ||
[*.json] | ||
indent_style = space | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[flake8] | ||
max-line-length = 88 | ||
exclude = .git,__pycache__,docs/source/conf.py,old,build,dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: ["douglaslassance"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: CD | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.x" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: Publish on PyPI | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload --verbose dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.7, 3.8, 3.9] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install requirements | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --editable ".[ci]" | ||
- name: Lint with flake8 | ||
run: | | ||
flake8 . --count --show-source --statistics | ||
- name: Test with pytest | ||
run: | | ||
pytest --cov=gitalong | ||
- name: Document with sphinx | ||
run: | | ||
sphinx-build ./docs/source ./docs/build | ||
- name: Upload report on CodeCov | ||
run: | | ||
bash <(curl -s https://codecov.io/bash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,3 +134,12 @@ dmypy.json | |
|
||
# macOS | ||
.DS_Store | ||
|
||
# VS Code | ||
.vscode/ | ||
|
||
# IntelliJ IDEA | ||
.idea/ | ||
|
||
# pytest-profiling | ||
/prof/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[MASTER] | ||
|
||
ignore=docs, __pycache__ | ||
disable= | ||
no-member, | ||
too-many-arguments, | ||
too-few-public-methods, | ||
logging-format-interpolation, | ||
missing-module-docstring | ||
|
||
|
||
[FORMAT] | ||
|
||
max-line-length=88 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Playsthetic | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# gitalong-python | ||
|
||
[![PyPI version](https://badge.fury.io/py/gitalong-python.svg)](https://badge.fury.io/py/gitalong-python) | ||
[![Documentation Status](https://readthedocs.org/projects/gitalong-python/badge/?version=latest)](https://gitalong-python.readthedocs.io/en/latest) | ||
[![codecov](https://codecov.io/gh/douglaslassance/gitalong-python/branch/main/graph/badge.svg?token=5267NA3EQQ)](https://codecov.io/gh/douglaslassance/gitalong-python) | ||
|
||
A Python API allowing to interact with Gitalong features on a Git repository. | ||
More about Gitalong in this [medium article](). | ||
|
||
## Pre-requisites | ||
|
||
- [Git >=2.35.1](https://git-scm.com/downloads) | ||
|
||
## Installation | ||
|
||
``` | ||
pip install gitalong | ||
``` | ||
|
||
## Usage | ||
|
||
```python | ||
from pprint import pprint | ||
|
||
from gitalong import Gitalong, GitalongNotInstalled | ||
|
||
try: | ||
gitalong = Gitalong(managed_repository_path) | ||
except GitalongNotInstalled: | ||
# Gitalong stores its data in its own repository therefore we need to pass that repository URL. | ||
gitalong = Gitalong.install(managed_repository_path, data_repository_url) | ||
|
||
# Now we'll get the last commit for a given file. | ||
# This could return a dummy commit representing uncommitted changes. | ||
last_commit = gitalong.get_file_last_commit(filename) | ||
pprint(last_commit) | ||
|
||
spread = gitalong.get_commit_spread(commit) | ||
if commit_spread & CommitSpread.LOCAL_UNCOMMITTED == CommitSpread.LOCAL_UNCOMMITTED: | ||
print("Commit represents our local uncommitted changes." | ||
if commit_spread & CommitSpread.LOCAL_ACTIVE_BRANCH == CommitSpread.LOCAL_ACTIVE_BRANCH: | ||
print("Commit is on our local active branch." | ||
if commit_spread & CommitSpread.LOCAL_OTHER_BRANCH == CommitSpread.LOCAL_OTHER_BRANCH: | ||
print("Commit is in one ore more of our other local branches." | ||
if commit_spread & CommitSpread.REMOTE_MATCHING_BRANCH == CommitSpread.REMOTE_MATCHING_BRANCH: | ||
print("Commit is on the matching remote branch." | ||
if commit_spread & CommitSpread.REMOTE_OTHER_BRANCH == CommitSpread.REMOTE_OTHER_BRANCH: | ||
print("Commit is one ore more other remote branches." | ||
if commit_spread & CommitSpread.CLONE_OTHER_BRANCH == CommitSpread.CLONE_OTHER_BRANCH: | ||
print("Commit is on someone else's clone non-matching branch." | ||
if commit_spread & CommitSpread.CLONE_MATCHING_BRANCH == CommitSpread.CLONE_MATCHING_BRANCH: | ||
print("Commit is on another clone's matching branch." | ||
if commit_spread & CommitSpread.CLONE_UNCOMMITTED == CommitSpread.CLONE_UNCOMMITTED: | ||
print("Commit represents someone else's uncommitted changes." | ||
|
||
# To update tracked commit with the ones based on local changes. | ||
gitalong.update_tracked_commits() | ||
|
||
# To update permissions of tracked files. | ||
gitalong.update_binary_permissions() | ||
``` | ||
|
||
# Development | ||
|
||
This projects requires the following: | ||
|
||
- [Python >=3.7](https://www.python.org/downloads/) | ||
- [virtualenwrapper](https://pypi.org/project/virtualenvwrapper/) (macOS/Linux) | ||
- [virtualenwrapper-win](https://pypi.org/project/virtualenvwrapper-win/) (Windows) | ||
|
||
Make sure your `WORKON_HOME` environment variable is set on Windows, and create a `gitalong-python` virtual environment with `mkvirtualenv`. | ||
Build systems for installing requirements and running tests are on board of the SublimeText project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = source | ||
BUILDDIR = build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=source | ||
set BUILDDIR=build | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.http://sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
Oops, something went wrong.