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.0 (Unreleased)

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_file_mapper-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 32dcb6d6011f20ec8181b6a8bb1fddd226d1ae7f5d959287997be0e7ef5ab34b
MD5 f2c7d816e5435d0235666e22a3d5d108
BLAKE2b-256 6cbda3494da273bc11f6d4721f488b7a5124a77dacf004aedce92ed09ec38fd8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: git_file_mapper-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d833d6384ea0b470c54519d7fc0d9bb4302c5299b6a00dc55c510c0d3f0dac5
MD5 252d154bd1a5b8676df3e8c8684842b6
BLAKE2b-256 1057aee533098f263415a85090f4a78ed7e909856ce1a3b8d081c0bfd5567b64

See more details on using hashes here.

Supported by

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