Ublame
Artist’s rendering of the bathyscaphe Trieste – britannica.com
/ˈublaːm(ə)/ :
git blamewith some depth.Portmanteau word from :1. u-boat: anglicised version of the German word U-Boot that refers to any submarine2. blame: git command that annotate each line in a given file with information from the revision which last modified the line.
Install
cronicle is written for Python 3.6+ and is tested on Linux.
Install with pip via pip3 install ublame command.
Why
ublame is born from the frustration of using git blame to track the successive editors of a code segment. It performs a search on a file commits history and reports all the revisions that contain searched term in their diffs.
See SO question Git blame — prior commits?
Example
The last modification is not always the information you need when you try to grasp a piece of code.
❯ git blame tests/rsrc/example.py | grep "if token in diff"
e65d24b3 (Fabrice Laporte 2020-11-04 2132 +0100 8) if token in diff:
❯ git show e65d24b3
commit e65d24b336570822d33f91847542743969b17fa2 (HEAD -> main)
Author: Fabrice Laporte
Date: Wed Nov 4 2132 2020 +0100
chore: convert tabs to spaces
In that example, the last commit modified the code only to convert tabs to spaces and previous commits that were probably more interesting to get the original intention of the developer(s) are not captured by git blame. So you need to apply git blame on the version of the file preceding e65d24b3 and so on …
With ublame the information is instantly available in one command :
❯ ublame tests/rsrc/example.py "if token in diff"
Commit: e65d24b336570822d33f91847542743969b17fa2
Author: Fabrice Laporte
Date: 2020-11-04 2233+01:00
chore: convert tabs to spaces
def trim_diff(diff, token):
- """Keep only context surrounding searched token.
- """
- if token in diff:
- LOC_BEFORE = LOC_AFTER = 3
- lines = diff.split("\n")
Commit: 01c5f3e2a91bcffbb5bdb24cac20d76f98b33db4
Author: Fabrice Laporte <fabrice@yescapa.com>
Date: 2020-11-04 2230+01:00
tests: add example.py
+def trim_diff(diff, token):
+ """Keep only context surrounding searched token.
+ """
+ if token in diff:
+ LOC_BEFORE = LOC_AFTER = 3
+ lines = diff.split("\n")
Screenshot
Metadata
Release files for ublame 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ublame-0.1.0.tar.gz | 5.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ublame-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.3 kB
Release files / ublame-0.1.0.tar.gz
| Download URL | ublame-0.1.0.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
930d8f381e300bc9efee941ebc5399f52520be9acb2cb34161fd6a840aa919c8
|
|
BLAKE2b-256 checksum How to use checksums |
b93c44c8cfc2b15646efb1ea484c4ea5409b3ce1dcce8c6141a287dcee3c7393
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.6
|
Release files / ublame-0.1.0-py3-none-any.whl
| Download URL | ublame-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b1aaaa57d4b436093a98f46687dafc22704080fee40804ffe7d52d2f8942973
|
|
BLAKE2b-256 checksum How to use checksums |
ac1adf070041faec25dc2c2a861a6420bbcbd74edc0a9f30f1ec517001c29b11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.6
|
Security for ublame 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.