Skip to main content

A library to aggregate git branches from different remotes into a consolidated one

Project description

License: AGPL-3 https://travis-ci.org/acsone/git-aggregator.svg?branch=master https://coveralls.io/repos/acsone/git-aggregator/badge.png?branch=master Python support: 2.7, 3.3, 3.4, 3.5

git-aggregator

Manage the aggregation of git branches from different remotes to build a consolidated one.

Configuration file

Create a repos.yaml file:

./product_attribute:
    remotes:
        oca: https://github.com/OCA/product-attribute.git
        acsone: git+ssh://git@github.com/acsone/product-attribute.git
    merges:
        - oca 8.0
        - oca refs/pull/105/head
        - oca refs/pull/106/head
    target: acsone aggregated_branch_name

./connector-interfaces:
    remotes:
        oca:  https://github.com/OCA/connector-interfaces.git
        acsone:  https://github.com/acsone/connector-interfaces.git
    merges:
        - oca 6054de2c4e669f85cec380da90d746061967dc83
        - acsone 8.0-connector_flow
        - acsone 80_connector_flow_ir_cron_able-lmi
        - acsone 8.0_connector_flow_improve_eval_config
    target: acsone aggregated_branch_name
    fetch_all:
        - oca

Environment variables inside of this file will be expanded if the proper option is selected.

Fetching only required branches

If any of your merges refer to a specific commit, you will probably need to fetch all remotes from the corresponding remote or use any other strategy to get that fetch working, but we recommend to simply add this like in the example above:

fetch_all:
    - oca
    - other-remote

You can specify that you want to fetch all references from all remotes you have defined with:

fetch_all: true

Shallow repositories

To save big amounts of bandwidth and disk space, you can use shallow clones. These download only a restricted amount of commits depending on some criteria. Available options are depth, shallow-since and shallow-exclude.

You can use those in the defaults sections to apply them everywhere, or specifying them in the corresponding merges section, for which you must use the dict alternate construction. If you need to disable a default in merges, set it to false:

./odoo:
    defaults:
        depth: 20
    remotes:
        odoo: https://github.com/odoo/odoo.git
        ocb: https://github.com/OCA/OCB.git
        acsone: https://github.com/acsone/odoo.git
    merges:
        -
            remote: ocb
            ref: "9.0"
            depth: 1000
        -
            remote: odoo
            ref: refs/pull/14859/head
    target: acsone 9.0

Remember that you need to fetch at least the common ancestor of all merges for it to succeed.

Triggers

It’s also possible to specify a command or a list of shell commands to execute after the aggregation (and before the push). The commands are executed into the aggregated directory.

./product_attribute:
    remotes:
    oca: https://github.com/OCA/product-attribute.git
    acsone: git+ssh://git@github.com/acsone/product-attribute.git
    merges:
        - oca 8.0
    target: acsone aggregated_branch_name
        shell_command_after: echo 'my command'

./connector-interfaces:
    remotes:
    oca:  https://github.com/OCA/connector-interfaces.git
    acsone:  https://github.com/acsone/connector-interfaces.git
    merges:
        - oca 9.0
    target: acsone aggregated_branch_name
        shell_command_after:
            - echo 'a first command'
            - echo 'a second command'

Command line Usage

Following the example repos.yaml file from above, aggregate your repositories at any time:

$ gitaggregate -c repos.yaml

Expand environment variables inside of the configuration file when loading:

$ gitaggregate -c repos.yaml --expand-env

You can also aggregate and automatically push the result to the target:

$ gitaggregate -c repos.yaml -p

Only aggregate a specific repository using fnmatch:

$ gitaggregate -c repos.yaml -p -d connector-interfaces

Changes

1.1.0 (Feb, 01, 2017)

1.0.0 (Jan, 19, 2016)

  • First release

Credits

Author

Contributors

Maintainer

ACSONE SA/NV

This project is maintained by ACSONE SA/NV.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git-aggregator-1.1.0.tar.gz (30.5 kB view details)

Uploaded Source

Built Distribution

git_aggregator-1.1.0-py2.py3-none-any.whl (16.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file git-aggregator-1.1.0.tar.gz.

File metadata

File hashes

Hashes for git-aggregator-1.1.0.tar.gz
Algorithm Hash digest
SHA256 814a3306d8bdce8edb3e9f42769675ac3ebdcf5763896376080f9f416d3251ad
MD5 a66ef28462f7c6d9c025e5345a796631
BLAKE2b-256 5e976ac78de1a4e1f7c5f81c9f704779eb046150dd39d7e0989002c4dcbaa459

See more details on using hashes here.

File details

Details for the file git_aggregator-1.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for git_aggregator-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 955611132379a4392f1d614efaed3170f114c316896a1c683434c1315dedf205
MD5 b028d5eb322df1e6dbe464ba49e48c0d
BLAKE2b-256 6f1ca6b498dfc1b5a3289db561cd63bf97bd7e1591bbb86fe3765495c37aa7db

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page