Search and replace tool that outputs a diff compatible with patch
Project description
Description
sar is a simple search and replace script that outputs a valid diff file for review and later apply with patch.
Installation
$ pip install sar-tool
Usage
$ sar unified_diff megasuper_diff sar.py
Searching for 'unified_diff' and replacing to 'megasuper_diff'
Processing file sar.py ... MATCH FOUND
Index: sar.py
================================================================================
--- sar.py (original)
+++ sar.py (modified)
@@ -88,7 +88,7 @@
debug("MATCH FOUND\n")
print "Index:", filename
print "=" * 80
- diff = ''.join(list(difflib.unified_diff(orig.splitlines(1),
+ diff = ''.join(list(difflib.megasuper_diff(orig.splitlines(1),
res.splitlines(1),
filename + " (original)",
filename + " (modified)")))
Licence
This script is released under the MIT licence
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sar-tool-1.0.3.tar.gz
(3.6 kB
view details)
File details
Details for the file sar-tool-1.0.3.tar.gz.
File metadata
- Download URL: sar-tool-1.0.3.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7dc83efe9e619af3c6b39e1882414039b8042a698e92e138b43d75da3610bd12
|
|
| MD5 |
bbf492b25046f482c35666175afacb4a
|
|
| BLAKE2b-256 |
382894cb0fd400d99934f93c6d2fcf7e05cec5b3a86fa7ec3f478de98a31cee8
|