19

I'm trying to import an Android Studio project in my SVN repository. I obiviously tried

VCS->Import into Version Control->Import into Subversion...

but the problem is that, even unchecking the Include ignored resources box, the software keeps uploading basically all the files in the project folder to SVN. I also tried to do Share Project (Subversion) and it doesn't upload anything (just creates the remote folder): when i try to commit, it wants to upload all files like the import option.

I also tried to play a bit with the svn:ignore property, but with not much luck.

My questions are:

  1. What's the best way to do this?
  2. Shouldn't Android Studio automatically take care of these things? If no, why?

Thanks for the help.

MMauro
  • 687
  • 2
  • 6
  • 14

4 Answers4

10

I followed these steps and I have successfully imported the android project into subversion repository.

(1) Enable VCS integration (under the VCS)

(2) Settings -> Version Control -> Ignored Files (add the files, folders in your .gitignore file here) - It should be like below image. After this you can see the ignored files in separate color(like yellow) and other files that need to add to subversion in another color(red)

Type intellij here and it will give you the ignored file list

enter image description here

(3) VCS -> Import Into Version Control -> Import into Subversion (I'm using subversion).Select the parent folder, not app folder.

(4) In the dialog uncheck 'Include ignored resources' then import

(5) Finally Checkout the project into the same project folder. After this the color of the files(red) that were added to remote repository will be disappeared.

Note: You can create a new remote folder after giving the repository location(VCS -> Browse VCS Repository -> Browse Subversion Repository)

chathura
  • 3,362
  • 6
  • 41
  • 68
  • 6
    How should this work? This stupid IDE checks in the ignored files as well, even if 'Include ignored resources' is unchecked. Nevertheless I tried your way, but this doesn't work as well. I cannot check out into a working copy (error message). – Bevor Aug 13 '16 at 15:39
  • @Bevor you need to put files that you don't want to be versioned into igonred file list as above image. If you put a mask remember to add asterisk (it doesn't included in the pic). So it sholud be like this: *.txt, *.log etc.. – chathura Aug 13 '16 at 16:05
  • 1
    Just like Bevor, The ide checked in everything including all the generated files. The ignore files doesn't work at all. – Jay Sep 05 '16 at 20:58
  • 1
    I agree with Bevor, this doesn't work. Thanks for your answer though. – Alberto M Oct 03 '16 at 07:39
5

You're on the right track, the svn:ignore is a template/list to define files that subversion should ignore. If you're doing this on Windows I suggest using free TortoiseSVN client that has a nice explorer-integrated GUI to make life much easier. It's just right click on a file -> TortoiseSVN -> add to ignore list.

Also, just found a post here that has the actual svn:ignore list for your projects: What files should I add to SVN ignore in an Project using Android Studio

Edited, as per comments, adding the list:

gradle
.idea
*.iml
build
.DS_Store ( => for mac only)
Community
  • 1
  • 1
Lucius
  • 430
  • 4
  • 8
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Andrew Mar 27 '15 at 20:57
  • Thanks Andrew, edited the answer and copied the list. – Lucius Mar 28 '15 at 21:54
  • And immediately received a downvote, what the hell :) – Lucius Mar 28 '15 at 21:57
  • Wasn't me, but I'll help even things out. – Andrew Mar 30 '15 at 15:40
  • Ha ha :) don't worry about it, but thanks ! Maybe it happens automatically when editing too much at once or something. I'm a newcomer, still figuring out how it all works. – Lucius Apr 01 '15 at 13:02
  • It's not automatic, for what that's worth. – Andrew Apr 01 '15 at 14:12
4

Adding a contrary opinion; I found that the ignore files was the wrong approach. Importing into SVN seemed to completely ignore the Ingore list and checked in everything..

I used Tortoise SVN which recommends not to use import, and to Import in Place

In Tortoise explorer popup:

  • TortoiseSVN -> Browse Repository: Create a folder in the repository to be your project root.
  • TortoiseSVN -> Checkout: Checkout the root folder over the project root (and ignore the warning that you are checking out into a non-empty directory.)
  • On build folder -> TortoiseSVN -> Add to Ingore List (Probably not strictly needed, but makes the following step much easier with fewer generated files.)
  • TortoiseSVN -> Add which then lets you pick individual directories and files. This was the best list of files/directories to ignore.

Then in Android Studio:

  • (Enable VCS Features in VCS menu if not enabled already)
  • Commit Changes, which will sync the file status and seems to pickup the files that were in the Add change list from Tortoise. (My flailing around with above answers may have gotten AS in a weird state, so hopefully this will be available for you!)
Community
  • 1
  • 1
Jay
  • 3,203
  • 2
  • 25
  • 31
4

These steps worked for me (using a Mac):

  1. Enable VCS Integration
  2. Setup ignore files in Android Studio / Preferences / Version Control / Ignored Files Directory: .gradle/ Directory: .idea/ Mask: *.iml Directory: build/ Mask: .DS_Store Directory: app/build/

  3. Upper left hand corner, change dropdown from ‘Android’ to ‘Project’

  4. Close / reopen your project in Android Studio. Make sure the ignored files are not in red.
  5. Right click on project name, click on Subversion / Share Directory
  6. Choose correct target path, choose 1.6
  7. You should get a prompt telling you to commit to complete the process.
  8. Right click on project, Subversion / Commit Directory, Commit