help

Using SVN in Terminal

Resources

Create a new project

If you create a new project that is not in your SVN repo, you need to import the project first. Go into your project folder in terminal (e.g., you should inside Myruns1 folder), you can type “pwd” to check your current path or “ls” to list files under your folder.

To import your project, use

svn import path -m "message"

command. For example in lab1, type

svn import https://svn.cs.dartmouth.edu/classes/cs65-W15/Lixing_Lian/Lab1_submission -m "import myruns1"

in terminal to import the project. (You don’t have to create the Lab1_submission on svn in advance, it will create it for you if it doesn’t exist)

You may need to enter your SVN credentials.

About login credentials:

Your login names are the "full" dnd names, as reported on the web site http://dndlookup.dartmouth.edu with the capitalization shown there, and please use your DND passwords (which you use for Dartmouth Banner).

After that, you can open your web browser and go to the address https://svn.cs.dartmouth.edu/classes/cs65-W15/Your_Name/Lab1_submission, you can see the project is successfully uploaded.

Checkout your project

Before you start work on your project, you need to checkout your code first. And you should close your project in Android studio before checkout. Go inside the project folder in terminal, type

svn checkout svn_address local_path 

For example, you can checkout your lab1 using

svn checkout https://svn.cs.dartmouth.edu/classes/cs65-W15/Lixing_Lian/Lab1_submission/ . 

Pay attention that there is a space and “.” after the svn path in the command, that means checkout the contents of the svn repo to your current folder. After sucessfully checkout, you can start work on your project in Android Studio.

Working your project

After you checkout the project from SVN, you can start writing your new codes in your project. If you create a new file, you need to type

svn add local_path_to_file 

to add the file to stage, then it will be updated to svn repo after you commit. For example, if you create a TestActivity, you need to add it in terminal:

svn add app/src/main/java/edu/dartmouth/cs/lixing/myruns1/TestActivity.java

You can type

svn status

to check which files are changed,

If it shows “M” in front of the file, that means the files has modified; “A” means the file is newly added; “?” means you created the file in your local folder, but you didn’t execute “svn add” and the file is not in the stage, that file won’t be committed to your svn repo after your commit. (In this case, you need to execute “svn add file” to add it to the stage.) Some config/environment files are displayed here because Android studio updated them.

You can also type

svn diff path_to_file 

to check the changes to a file. In lab1 example, we type

svn diff app/src/main/java/edu/dartmouth/cs/lixing/myruns1/MainActivity.java 

Once you finish your coding or want to update your code to SVN repo, type

svn commit –m “commit message”

to commit your updates. Then you can see the changes on your repo.

Delete file in SVN repo

To delete a file in SVN repo, you can remove the local file and commit your changes to repo. Here is the other way to do that

svn delete https://svn.cs.dartmouth.edu/classes/cs65-W15/Lixing_Lian/Lab1_submission/app/.gitignore -m “delete .gitignore file”

It will delete the file https://svn.cs.dartmouth.edu/classes/cs65-W15/Lixing_Lian/Lab1_submission/app/.gitignore remotely. You can also delete an SVN folder by using this "svn delete" command.