Giter Club home page Giter Club logo

Comments (9)

marcows avatar marcows commented on July 18, 2024 1

@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.

marcows avatar marcows commented on July 18, 2024 1

@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.

newren avatar newren commented on July 18, 2024

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.

zabeloliver avatar zabeloliver commented on July 18, 2024

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.

newren avatar newren commented on July 18, 2024

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.

marcows avatar marcows commented on July 18, 2024

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.

glensc avatar glensc commented on July 18, 2024

@marcows why share branch if you could just easily send a PR?

from git-filter-repo.

newren avatar newren commented on July 18, 2024

@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.

glensc avatar glensc commented on July 18, 2024

git commit of the adding for posterity:

from git-filter-repo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.