6 releases

0.4.1 Sep 9, 2024
0.4.0 Aug 28, 2024
0.3.2 Aug 28, 2024
0.1.0 Aug 27, 2024

#719 in Development tools

MIT/Apache

31KB
366 lines

Fork Manager

CI Nix Release pre-commit.ci status

Automatize your fork

Configuration

config: # optional, just displayed in generated README
  repo: git@github.com:gepetto/forks
  branch: master  # default branch from that repo if not specified
forks:
- name: gepetto-nixpkgs-master
  target:
    repo: git@github.com:gepetto/nixpkgs
    branch: master
  upstream:
    repo: git@github.com:NixOS/nixpkgs
    branch: master  # Same as target branch if not specified
  changes:
  - title: Package HPP  # default to branch name if not specified
    repo: git@github.com:nim65s/nixpkgs
    branch: hpp
  - pr: 331343  # get title + repo + branch from upstream github PR
- name: gepetto-nixpkgs-devel
  target:
    repo: git@github.com:gepetto/nixpkgs
    branch: devel
  upstream:
    repo: git@github.com:gepetto/nixpkgs
    branch: master
  changes:
  - title: prepare hpp-fcl renaming to coal
    repo: git@github.com:nim65s/nixpkgs
    branch: coal

This configure the gepetto/forks github project, which manage the gepetto-nixpkgs-master and gepetto-nixpkgs-devel forks:

  • The first takes github:NixOS/nixpkgs/master, merge one branch and one PR, and force push that to github:gepetto/nixpkgs/master.
  • Thes second take this fresh github:gepetto/nixpkgs/master, merge an additinal branch, and force push that to github:gepetto/nixpkgs/devel.

It will generate a ./update.sh script which will work in one submodule per fork, and whose actual push is gated with a push flag.

If a file named test-{fork}.sh exists, it will be run.

CLI

$ fork-manager -h
Automatize your fork

Usage: fork-manager [OPTIONS]

Options:
  -c, --config-file <CONFIG_FILE>      Path to the configuration file. If not given, or not a file, this will be
                                       searched according to arguments "project" and "filename"
                                       [env: FORK_MANAGER_CONFIG_FILE=] [default: ./fork-manager.yaml]
  -f, --filename <FILENAME>            Name of the configuration file to look for
                                       [env: FORK_MANAGER_CONFIG_FILENAME=] [default: fork-manager.yaml]
  -p, --project <PROJECT>              Path to the project where to look for
                                       [env: FORK_MANAGER_PROJECT=] [default: .]
  -u, --update-script <UPDATE_SCRIPT>  Name of the script to generate
                                       [env: FORK_MANAGER_UPDATE_SCRIPT=] [default: update.sh]
      --generate <GENERATOR>           If provided, outputs the completion file for given shell and exit
                                       [possible values: bash, elvish, fish, powershell, zsh]
  -d, --dry-run                        Only check config, don't run git commands
  -h, --help                           Print help
  -V, --version                        Print version

Dependencies

~17–29MB
~468K SLoC