Skip to main content

Git File Mapper

A programme that applies a map operation to files in git. This can be used to transform an entire tree of reachable objects in a git repository. This does not remove the existing objects, it creates new ones.

While this can be used to apply an automatic formatter (such as Python's black) to the entire history of a project, meaning that every file in every revision is compliant. However, this is not a good way to apply a formatter. Like all operations that change the history of a git repository, this can cause trouble as any users who have an old copy of the tree will need to update their checkouts to use the new references. This can be an absolute nightmare for branching.

The reason I created this is to allow the creation of read-only parallel trees that have an automatic transform applied. Specifically, I plan to use this to create a history of apd.sensors that does not include the type hints, so people who aren't interested in typing can browse the code for Advanced Python Development more easily.

Usage

For example, to apply black to all Python files and save references with a suffix, so main becomes main-black, do:

$ git-map-files black --transform "*.py" "black -"

You may pass any number of --transform arguments. They will be parsed in order, with the first matching transform being the only one that's applied. If no transforms match then no change is made.

This will create variants of all branches and tags, so you must ensure that there are no conflicts before running.

Changes

1.0.1 (2020-07-10)

  • Ensure that git tree objects are sorted to prevent pushes being rejected

1.0.0 (2020-07-10)

  • Initial release of mapping tool

Copyright (c) 2020, Matthew Wilkes

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Release files for git-file-mapper 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for git-file-mapper 1.0.1
File Size Uploaded
git_file_mapper-1.0.1.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for git-file-mapper 1.0.1
File Interpreter ABI Platform
git_file_mapper-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.3 kB

Release files / git_file_mapper-1.0.1.tar.gz

Download URL git_file_mapper-1.0.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
92ed8820615fa3841808126d645abf15f87caac709b8bc9b769eaf6c6841f100
BLAKE2b-256 checksum
How to use checksums
66d5187c472e25f9cacb11f91c831d974460cb5ab1a236ad3bcbbef1bc5fd92f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.0

Release files / git_file_mapper-1.0.1-py3-none-any.whl

Download URL git_file_mapper-1.0.1-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b53239cd49c8743ae7901a5e4b3f36a9a79bf4e9b1698aa05aa517205eda6f06
BLAKE2b-256 checksum
How to use checksums
74394c099f3d630308c5f0b4abb27f544e057d8ddc4ff5703c841c2776484a11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.0

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page