2019-04-01 23:35:49 +02:00
|
|
|
#!/usr/bin/env python3
|
2018-11-05 15:31:06 +01:00
|
|
|
|
2019-03-05 20:00:11 +01:00
|
|
|
"""
|
|
|
|
Please see the
|
|
|
|
***** API BACKWARD COMPATIBILITY CAVEAT *****
|
|
|
|
near the top of git-filter-repo
|
|
|
|
"""
|
|
|
|
|
2018-11-05 15:31:06 +01:00
|
|
|
import re
|
2019-02-10 03:24:37 +01:00
|
|
|
import datetime
|
|
|
|
|
|
|
|
import git_filter_repo as fr
|
2018-11-05 15:31:06 +01:00
|
|
|
|
|
|
|
def change_up_them_commits(commit):
|
|
|
|
# Change the commit author
|
2019-04-28 00:18:59 +02:00
|
|
|
if commit.author_name == b"Copy N. Paste":
|
|
|
|
commit.author_name = b"Ima L. Oser"
|
|
|
|
commit.author_email = b"aloser@my.corp"
|
2018-11-05 15:31:06 +01:00
|
|
|
|
|
|
|
# Fix the author email
|
2019-04-28 00:18:59 +02:00
|
|
|
commit.author_email = re.sub(b"@my.crp", b"@my.corp", commit.author_email)
|
2018-11-05 15:31:06 +01:00
|
|
|
|
|
|
|
# Fix the committer date (bad timezone conversion in initial import)
|
2019-02-10 03:24:37 +01:00
|
|
|
oldtime = fr.string_to_date(commit.committer_date)
|
|
|
|
newtime = oldtime + datetime.timedelta(hours=-5)
|
|
|
|
commit.committer_date = fr.date_to_string(newtime)
|
2018-11-05 15:31:06 +01:00
|
|
|
|
|
|
|
# Fix the commit message
|
2019-04-28 00:18:59 +02:00
|
|
|
commit.message = re.sub(b"Marketing is staffed with pansies", b"",
|
2018-11-05 15:31:06 +01:00
|
|
|
commit.message)
|
|
|
|
|
2019-02-10 03:24:37 +01:00
|
|
|
args = fr.FilteringOptions.parse_args(['--force'])
|
|
|
|
filter = fr.RepoFilter(args, commit_callback = change_up_them_commits)
|
2018-11-05 15:31:06 +01:00
|
|
|
filter.run()
|