WIP: mostly scratch code still

This commit is contained in:
Manuel Barkhau 2018-09-02 21:48:12 +02:00
parent e2e218bce9
commit 3471560eaa
20 changed files with 1757 additions and 1 deletions

21
src/pycalver/rewrite.py Normal file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env python
# This file is part of the pycalver project
# https://github.com/mbarkhau/pycalver
#
# (C) 2018 Manuel Barkhau (@mbarkhau)
# SPDX-License-Identifier: MIT
import logging
import difflib
log = logging.getLogger("pycalver.rewrite")
def rewrite_file(file: str, pattern: str, dry=False) -> None:
difflib.unified_diff(
file_content_before.splitlines(),
file_content_after.splitlines(),
lineterm="",
fromfile="a/" + file,
tofile="b/" + file,
)