Friday, January 2, 2009

How-to create svn server (subversion) in iPhone

This guide shows you how to setup svn+ssh server in pwned iPhone

(1) Install subversion package in Cydia
apt-get install subversion

(2) create repository in iPhone (e.g. with the Project called UICatalog)

mkdir -p /var/root/Library/Subversion/Repository
svnadmin create /var/root/Library/Subversion/Repository/UICatalog
mkdir -p /tmp/UICatalog/trunk /tmp/UICatalog/branches /tmp/UICatalog/tags
svn import /tmp/UICatalog/ file:///var/root/Library/Subversion/Repository/UICatalog -m "Create Directory Structure"
rm -rf /tmp/UICatalog


(3) Import Project directory
import from iPhone
svn import UICatalog file:///var/root/Library/Subversion/Repository/UICatalog/trunk -m "Import project dir from iPhone"

import from Mac (assume iPhone IP is 10.0.2.2)
svn import UICatalog svn+ssh://root@10.0.2.2/var/root/Library/Subversion/Repository/UICatalog/trunk -m "Import project dir from Mac"

(4) Checkout Project directory
checkout to Mac (assume iPhone IP is 10.0.2.2)
svn checkout svn+ssh://root@10.0.2.2/var/root/Library/Subversion/Repository/UICatalog/trunk UICatalog

checkout a specific revision 5 to Mac (assume iPhone IP is 10.0.2.2)
svn co -r 5 svn+ssh://root@10.0.2.2/var/root/Library/Subversion/Repository/UICatalog/trunk UICatalogR2

checkout to iPhone to another dir
svn checkout file:///var/root/Library/Subversion/Repository/UICatalog/trunk UICatalog2

checkout a specific revision 5 to iPhone
svn co -r 5 file:///var/root/Library/Subversion/Repository/UICatalog/trunk UICatalog_v5


(5)Other useful svn commands
(change directory to the working copy that was checkout in iPhone)
cd UICatalog2
svn info
svn commit -m 'commit changes'
svn ls file:///var/root/Library/Subversion/Repository/UICatalog/trunk
svn log


(change directory to the working copy that was checkout in Mac)
cd UICatalog
svn add newfile.m
svn info
svn commit -m 'commit changes'
svn ls svn+ssh://root@10.0.2.2/var/root/Library/Subversion/Repository/UICatalog/trunk
svn log


(6) svn to googlecode.com
svn checkout https://<yourproject>.googlecode.com/svn/trunk/<yourprojectdirname> --username <your username without @gmail.com>

When prompted, enter your generated googlecode.com password.
The googlecode.com svn password is in the googlecode.com (it is not the same as the gmail password)

Profile -> Settings

cd <yourprojectdirname>
svn add newfile.m
svn commit -m 'commit changes: adding newfile.m'


import to a subdirectory
svn import <yourprojectdirname> https://<yourproject>.googlecode.com/svn/trunk/<yourprojectdirname>/ --username <your username without @gmail.com> -m 'commit changes: importing'

delete directory/files that were in the wrong place
svn delete -m "Deleting wrong place commit" https://<yourproject>.googlecode.com/svn/trunk/<directorytobedeleted> https://<yourproject>.googlecode.com/svn/trunk/<filetobedeleted> ....

(7) Others
The use of Xcode 3 and subversion is in Apple documentation here
http://developer.apple.com/mac/articles/server/subversionwithxcode3.html

You can make use of this to manage SCM for XCode project to google code, Mac or iPhone


(8) GIT
If you need git on leopard, here
http://code.google.com/p/git-osx-installer/
or use MacPorts (port install git-core)

or you can compile and install from source

mkdir ~/src
cd ~/src/
curl -O http://kernel.org/pub/software/scm/git/git-1.6.5.3.tar.bz2
tar -xjvf git-1.6.5.3.tar.bz2
cd git-1.6.5.3
./configure --prefix=/usr/local
make
sudo make install
git --version





4 comments:

pierre said...

is this even posible? i cant even get this to work. apt-get dont work for me when i log on with putty as root.

javacom said...

You need to install APT 0.6 Transitional and Aptitude in Cydia, in order to have apt-get

blackxl said...

subversion/libsvn_client/commit.c:544: (apr_err=145000)
my email:root@blackxl.org , can you help me?

Anonymous said...

Is it possible to checkout a project on svn repository at iphone from an online web server?