Skip to main content

A programme that applies a map operation to files in git

Project description

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.

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_file_mapper-1.0.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

git_file_mapper-1.0.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file git_file_mapper-1.0.1.tar.gz.

File metadata

  • Download URL: git_file_mapper-1.0.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for git_file_mapper-1.0.1.tar.gz
Algorithm Hash digest
SHA256 92ed8820615fa3841808126d645abf15f87caac709b8bc9b769eaf6c6841f100
MD5 9adca848cb6db44309e9e762a2384ab0
BLAKE2b-256 66d5187c472e25f9cacb11f91c831d974460cb5ab1a236ad3bcbbef1bc5fd92f

See more details on using hashes here.

File details

Details for the file git_file_mapper-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: git_file_mapper-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for git_file_mapper-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b53239cd49c8743ae7901a5e4b3f36a9a79bf4e9b1698aa05aa517205eda6f06
MD5 eb14ac1e772eab34fc90341501cef794
BLAKE2b-256 74394c099f3d630308c5f0b4abb27f544e057d8ddc4ff5703c841c2776484a11

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