Merging repositories with JGit + altering commit messages [message #1828570] |
Fri, 12 June 2020 10:56  |
Eclipse User |
|
|
|
Hello all,
our team wants to merge several repositories (each with 500-5000 commits) into one. These repos are hosted in a private GitBucket instance. GitBucket has an issue tracking system similar to GitHub, and almost all of our commit messages contain one or more issue references.
We would like to migrate all previous issues from the old repos to the new (merged one). This means of course that the issue numbers will be changed, and therefore all commit messages must be also upgraded.
I was thinking whether it is possible to write an application using JGit to combine the repositories together an build up a map of old and new issue numbers.
For example, consider the following repos:
Repo 1: Repo 2:
#5 (HEAD) #5 (HEAD)
| |
Merge Merge
| | | |
#3 #4 #4 #3
| | | |
#3 | | #3
| | | |
#2 #2
| |
#1 #1
The desired result would be:
Merged Repo:
Merge (HEAD)
| \
| ---------
| \
#5 #10
| |
Merge Merge
| | | |
#3 #4 #9 #8
| | | |
#3 | | #8
| | | |
#2 #7
| |
#1 #6
Plus the issue number mapping for the old Repo 2:
1 -> 6
2 -> 7
3 -> 8
4 -> 9
5 -> 10
So the main concerns are to preserve the all the history (including branch splits and merges) and the connected issues.
Is this possible using the JGit API, either high or low-level? The points I'm not sure about:
- is it possible to walk through the commits of a repo, and apply them (like cherry pick) to a different repo (and of course altering the commit message)?
- is it possible to preserve branch splits and merges? Obviously replaying all the merges woulld not be possible because that would mean resolving all conflicts ever encountered once more, i guess?
Thanks for any pointers in advance.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.11383 seconds