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
svn import UICatalog svn+ssh://root@ -m "Import project dir from Mac"

(4) Checkout Project directory
checkout to Mac (assume iPhone IP is
svn checkout svn+ssh://root@ UICatalog

checkout a specific revision 5 to Mac (assume iPhone IP is
svn co -r 5 svn+ssh://root@ 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@
svn log

(6) svn to
svn checkout https://<yourproject><yourprojectdirname> --username <your username without>

When prompted, enter your generated password.
The svn password is in the (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><yourprojectdirname>/ --username <your username without> -m 'commit changes: importing'

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

(7) Others
The use of Xcode 3 and subversion is in Apple documentation here

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
or use MacPorts (port install git-core)

or you can compile and install from source

mkdir ~/src
cd ~/src/
curl -O
tar -xjvf git-
cd git-
./configure --prefix=/usr/local
sudo make install
git --version


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 , can you help me?

Anonymous said...

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