Comments (9)
@glensc I didn't open a PR because Elijah prefers patches to the mailing list. I shared the branch for Oliver, but will delete it now that it is already included.
from git-filter-repo.
@newren Many thanks for inclusion! Your comments were pretty helpful and it's very motivating to get such comprehensive replies as @zabeloliver pointed out already.
from git-filter-repo.
It should be possible, it's just some work. While I've heard of svn:externals, I'm not familiar with them, but as far as I can tell from what you've written the basic idea would go like this:
- First convert the submodule(s). For each, you need to keep a mapping from svn revision to git commit id.
- When converting the supermodule, for each commit you need to look at the .gitsvnextmodules file to see what submodules are wanted -- both their path name and the svn revision. For each submodule, get the mapping from svn revision to git commit id, then create a FileChange object (e.g.
FileChange(b'M', pathname, commit_id, b'160000')
where 160000 is the filemode that git uses for submodules) and add it to commit.file_changes. - Since git submodules also depend on a toplevel .gitmodules file, you'll also need to create that, either on the fly as submodules are added, or maybe just create it in the initial commit. Not being a heavy user of submodules, I don't know if git gets confused if you have a .gitmodules file in a version but don't have any actual submodules yet, so you may need to play with this. If it doesn't get confused, just adding the .gitmodules in the root commit(s) might be easiest.
- And, just to be tidy, you may want to remove the .gitsvnextmodules file from the commit as you go too.
This could possibly all be crammed into a --commit-callback, but it might be nicer (and more reusable) to create a full script like those in contrib/filter-repo-demos/.
Some additional pointers:
- the contrib/filter-repo-demos/lint-history script shows an example of how to add completely new files to the stream and make files in a commit reference them. That may be helpful for creating the .gitmodules file, even if it'll be a new file for you rather than a modification of an existing file.
- the contrib/filter-repo-demos/insert-beginning script shows an example of how to add extra files into a commit (in particular, appending to commit.file_changes). It also shows how you could tweak the "first commit" (or first commits) in history. In combination with the info from the lint-history script, this might be useful for your new .gitmodules file. Also, the appending to commit.file_changes is helpful for getting the submodule FileChange object added.
- the contrib/filter-repo-demos/clean-ignore script might be helpful in terms of how to get rid of unwanted changes (stripping files from commit.file_changes) to enable you to remove the .gitsvnextmodules files if you wanted to include that in the same filtering run.
If you give this a shot, I'm curious to hear how it works out. Feel free to ping if you run into roadblocks. And if it works out and you're willing to share the commands or script you come up with, it could be an awesome example to add to the contrib/filter-repo-demos/ directory (even if you have a few hacks, caveats or whatever; that directory already comes with a disclaimer).
from git-filter-repo.
Hi Elijah,
first of all, thank you very much for this comprehensive post! I think this will guide us definitively into the right direction and we will of course share our experience and scripts with you!
Best regards,
Oli
from git-filter-repo.
I'm going to go ahead and close this out just to keep the issues list tidy (though I've marked it with the contrib-candidate label so I can others can find it). If you do come up with some scripts or have further questions, please do ping. You can feel free to reopen, or if the issue is separate enough, just open a new issue. Thanks!
from git-filter-repo.
Hi Elijah, activity after a long time of silence here!
Oliver, the issue author, was a colleague of mine, but unfortunately doesn't work in our company anymore.
I just sent a patch out to the mailing list:
https://marc.info/?l=git&m=166500551728567&w=2
Living in this branch in my fork:
https://github.com/marcows/git-filter-repo/tree/svnext-conv
But these references are rather for you if interested, Oliver! Best wishes :-)
from git-filter-repo.
@marcows why share branch if you could just easily send a PR?
from git-filter-repo.
@marcows : As commented on your patch submission, I've included it. Thanks for submitting it! I hope my comments from nearly three years ago were helpful, because I don't anymore remember any of the svn externals stuff I apparently looked up at the time.
from git-filter-repo.
git commit of the adding for posterity:
from git-filter-repo.
Related Issues (20)
- Question: prune lfs files
- remark: Pity that this tool can't run scripts/programs and it is not clearly stated HOT 1
- minor: Logic error with `_commits_referenced_but_removed` on a GitHub Gist web url in commit message 😂
- Crash when path contains emoji HOT 1
- Question: Recommended way to log the usage of git filter-repo and related changes? HOT 1
- Callback that gives both filename and blob
- Breaking change in git 2.43 or 2.44 HOT 2
- lint-history: --refs argument not working at all HOT 1
- Test suite succedes with Python 3.11 but has multiple failures with Python 3.12 HOT 7
- Turns out my assumption was wrong: `git lfs migrate export --everything --include="*"` does rewrite the whole history, across all branches, reinjecting all the large files' consecutive versions ([see here](https://github.com/git-lfs/git-lfs/issues/910#issuecomment-551566315)). Awesome! HOT 1
- Support for SHA256
- FR: Filter into new repo HOT 1
- clean-ignore of filter-repo-demos does not handle utf-8 characters HOT 1
- Trouble with Lock File HOT 1
- Really-43e2c HOT 2
- Renaming path and then renaming it back to the original name deletes path rather than renaming it HOT 1
- Case-insenstive APFS volumes causing refs lock problem? HOT 1
- [Question] Repo size not shrinking after using --invert-paths HOT 6
- Clone rather than edit
- --paths-from-file only works with directories HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from git-filter-repo.