# ups | upstream scripts ![](https://git.ngn.tf/ngn/ups/actions/workflows/format.yml/badge.svg) ![](https://git.ngn.tf/ngn/ups/actions/workflows/release.yml/badge.svg) collection of bash and python scripts for pulling and managing patches from the upstream git repos of my personal forks ## installation you'll need the following dependencies to install and use ups: - make - pypa build package - git - python(3) - python requests module - GNU bash coreutils - sed after installing these tools, you can just clone the main branch and run the make script to build python library, then you can run the install make script to install the library and the scripts: ```bash git clone https://git.ngn.tf/ngn/ups cd ups make && make install ``` ## usage first navigate to your repo and a `ups.json` file this file should specify the upstream URL, and the provider for the upstream, currently gitea and github are the only supported providers for example here is my configuration for the [4get repo](https://git.ngn.tf/ngn/4get): ```json { "upstream": "https://git.lolcat.ca/lolcat/4get", "provider": "gitea" } ``` you should also specify the last commit you got from upstream, unless you are on the last commit: ```json ... "commit": "78aa2e198f11ca928891ec83ef97d2445147414a" ... ``` now to check for any upstream commits, you run `ups-check`, this script simply checks the last commit and compares it to the commit you specified in the configuration if you did not specfiy a commit it assumes you are on the latest commit, otherwise it compares the last commit ID with the current commit ID to see if you are on the latest commit if this is not the case, then it checks how many commits have been made between these two commits to actually apply these commits to your repo, as in the form of patches, you need to run `ups-update` this script will download all the commits as patches, and give you and option to modify or skip them before applying them it will also update the commit hash you specified in the configuration, when you apply all the commits you want, you'll also need to run `ups-commit` in order to commit the changes made to your configuration file ### scripts ups allows you to run custom sed script on the commit patches before applying them, so you don't need to edit all of them just to do some simple modifications every time for example, in the [4get repo](https://git.ngn.tf/ngn/4get), i placed all the php source code to `src` directory, which is not the case in the upstream so i added these two scripts to my configuration to automatically fix the diff paths of the patches: ```json ... "scripts": [ "s/--- a\\//--- a\\/src\\//g", "s/+++ b\\//+++ b\\/src\\//g" ] ... ```