2019-04-01 21:35:49 +00:00
|
|
|
#!/usr/bin/env python3
|
2018-11-05 14:31:06 +00:00
|
|
|
|
2019-03-05 19:00:11 +00:00
|
|
|
"""
|
|
|
|
Please see the
|
|
|
|
***** API BACKWARD COMPATIBILITY CAVEAT *****
|
|
|
|
near the top of git-filter-repo.
|
|
|
|
|
|
|
|
Also, note that splicing repos may need some special care as fast-export
|
|
|
|
only shows the files that changed relative to the first parent, so there
|
|
|
|
may be gotchas if you are to splice near merge commits; this example does
|
|
|
|
not try to handle any such special cases.
|
|
|
|
"""
|
|
|
|
|
2019-02-10 02:24:37 +00:00
|
|
|
import git_filter_repo as fr
|
2018-11-05 14:31:06 +00:00
|
|
|
|
|
|
|
def my_commit_callback(commit):
|
2019-04-27 22:18:59 +00:00
|
|
|
if commit.branch == b"refs/heads/master":
|
|
|
|
commit.branch = b"refs/heads/develop"
|
2018-11-05 14:31:06 +00:00
|
|
|
|
2019-02-10 02:24:37 +00:00
|
|
|
args = fr.FilteringOptions.default_options()
|
2018-11-05 14:31:06 +00:00
|
|
|
args.force = True
|
2019-02-10 02:24:37 +00:00
|
|
|
filter = fr.RepoFilter(args, commit_callback = my_commit_callback)
|
2018-11-05 14:31:06 +00:00
|
|
|
filter.run()
|