mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-09-19 00:00:08 +02:00
35052f673d
This is by far the largest python3 change; it consists basically of * using b'<str>' instead of '<str>' in lots of places * adding a .encode() if we really do work with a string but need to get it converted to a bytestring * replace uses of .format() with interpolation via the '%' operator, since bytestrings don't have a .format() method. Signed-off-by: Elijah Newren <newren@gmail.com>
35 lines
986 B
Python
Executable File
35 lines
986 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
"""
|
|
Please see the
|
|
***** API BACKWARD COMPATIBILITY CAVEAT *****
|
|
near the top of git-filter-repo
|
|
"""
|
|
|
|
import re
|
|
import datetime
|
|
|
|
import git_filter_repo as fr
|
|
|
|
def change_up_them_commits(commit):
|
|
# Change the commit author
|
|
if commit.author_name == b"Copy N. Paste":
|
|
commit.author_name = b"Ima L. Oser"
|
|
commit.author_email = b"aloser@my.corp"
|
|
|
|
# Fix the author email
|
|
commit.author_email = re.sub(b"@my.crp", b"@my.corp", commit.author_email)
|
|
|
|
# Fix the committer date (bad timezone conversion in initial import)
|
|
oldtime = fr.string_to_date(commit.committer_date)
|
|
newtime = oldtime + datetime.timedelta(hours=-5)
|
|
commit.committer_date = fr.date_to_string(newtime)
|
|
|
|
# Fix the commit message
|
|
commit.message = re.sub(b"Marketing is staffed with pansies", b"",
|
|
commit.message)
|
|
|
|
args = fr.FilteringOptions.parse_args(['--force'])
|
|
filter = fr.RepoFilter(args, commit_callback = change_up_them_commits)
|
|
filter.run()
|