2018-11-05 14:31:06 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
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):
|
|
|
|
if commit.branch == "refs/heads/master":
|
|
|
|
commit.branch = "refs/heads/develop"
|
|
|
|
|
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()
|