Migrating SVN to Android Studio

前端 未结 2 1415
我在风中等你
我在风中等你 2020-12-18 02:09

I\'m migrating my Android project from Eclipse to Android Studio. I use Subversion and am wondering how I can migrate my SVN to the new file structure used in Android Studio

相关标签:
2条回答
  • 2020-12-18 02:52

    I don't know the differences of both file structures. But it would try it this way:

    1. Check out your project (maybe better use a client like TortoiseSVN)
    2. Build the new file structure (new folders)
    3. Commit
    4. Move the files from the old structure to the new
    5. Commit (check the commit dialog if there are move actions only!)
    6. Delete old folders which you don't need anymore
    7. Commit

    SVN will recognize these move operations. You will see if it works by the operations in the commit dialog. If there are "delete"/"new" actions something went wrong there should only be "move" actions.

    0 讨论(0)
  • 2020-12-18 03:00

    Posting this because it might help someone else.

    I ran into the same problem as well. @user714965 was inspiring but didn't solve my problem because I couldn't figure out how to get SVN recognize that I moved a file from the original folder to the new structure in my working copy.

    For the following, you will need TortoiseSVN or a similar SVN GUI client to do this.

    Here is what I did:

    1. Commit the Eclipse project last changes into the SVN repo.
    2. Open Android Studio and use that to import the Eclipse project working copy.
    3. Android Studio will nicely convert the Eclipse project into a Android Studio/Gradle project. Let's call this project "PrjGradle".
    4. Open the converted Gradle project folder window and keep it one side of your screen
    5. Go into your SVN repo where you have your project (using TortoiseSVN).
    6. Backup your current trunk into a branch or a tag and call it "final_eclipse" or whatever.
    7. Now, mirror the folder structure of the newly converted Gradle project on your local machine directly on the TortoiseSVN Repo Browser window. Meaning, look at how the directory is structured in "PrkGradle" and create/delete/rename folders directly on the trunk repository. This will be painstakingly tedious but you have to bear with it if you want to preserve your SVN history.
    8. When you move files around (not copy) directly on the repo, the history of the files remain intact.
    9. Once you complete, check out the restructured directory into your local machine. Let's call this "NewPrj".
    10. Use a suitable Folder compare program (such as Beyond Compare) to synchronize missing items (such as build.gradle, .iml files, etc.)
    11. Rename your converted project to "PrjGradle_old", and rename the newly checked out project (NewPrj) to "PrjGradle".
    12. Open "PrjGradle" in Android Studio. That's it!

    Hope it works out.

    0 讨论(0)
提交回复
热议问题