Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
714 views
in Technique[技术] by (71.8m points)

eclipse - Migrating SVN to Android Studio

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 without losing my history.

Thanks for any help!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...