svn-all-fast-export / svn2git

:octopus: A fast-import based converter for an svn repo to git repos
GNU General Public License v3.0
262 stars 100 forks source link

How to best issue arbitrary file deletions in the fast-import stream #113

Closed uqs closed 4 years ago

uqs commented 4 years ago

Hi folks, I'm looking for some guidance on how to best fix up an old repo that has gone through cvs2svn already but that employed lots of CVS repo-copies (and even CVS repo moves) and now files show up in the wrong place, historically speaking.

To be clear, this problem is in the SVN repo already, but with our switch to git, now would be the last chance to clean that up, and it should be fairly easy to get a list of files that are out of place (but that's a different topic).

So I already hacked the converter to add a "strip" mode in addition to the "prefix" match action to munge some of the file paths better. What I would need now is a way to tag a certain SVN revision and inject an arbitrary list of file deletions (and file renames!)

How to best do this? I see that SvnRevision::exportInternal() issues file deletions already and that it has access to the rule matcher. So is it as simple as a two new keywords in the rule matcher and actions in exportInternal() based on that? glob or regexp support (with backreferences for the renames) would be terrific.

Any thoughts and advice?

uqs commented 4 years ago

For people that are desperate, I've implemented this in the worst possible way here:

Support for deletes: https://github.com/freebsd/git_conv/commit/510adaac28e84ef26443e4a3f20a6968b9cff36d

Support for renames: https://github.com/freebsd/git_conv/commit/1d4007dc389b4f70255226e7144db85884dcfc22

Don't try this at home, kids.