Panduan awal penggunaan Subversion
Subversion adalah versioning control system yang digunakan untuk mengelola file data. Perkembangan Subversion bisa dilihat di website Subversion. Materi kecil ini hanya sekedar pengenalan untuk operasional awal. Untuk materi lebih lengkap, silahkan dilihat di buku Version Control with Subversion (BenCollins-Sussman, et. al). Buku tersebut adalah buku bebas.
Awal
----
1. Menyiapkan Source Code:
Membuat direktori yang diperlukan:
bpdp@bpdp-desktop:~/kerjaan/buku/geronimo/src$ mkdir branches
bpdp@bpdp-desktop:~/kerjaan/buku/geronimo/src$ mkdir tags
bpdp@bpdp-desktop:~/kerjaan/buku/geronimo/src$ mkdir trunk
Memindahkan direktori proyek ke trunk (jeeProject):
bpdp@bpdp-desktop:~/kerjaan/buku/geronimo/src$ mv jeeProject trunk/
2. Membuat repository:
bpdp@bpdp-desktop:~/kerjaan/buku/geronimo$ svn import src/ file:///home/bpdp/svnrepo/workshopJEE -m "initial import"
Adding src/trunk
Adding src/trunk/jeeProject
Adding src/trunk/jeeProject/hello
Adding src/trunk/jeeProject/hello/WEB-INF
Adding src/trunk/jeeProject/hello/WEB-INF/web.xml
Adding (bin) src/trunk/jeeProject/hello/hellogeronimo.war
Adding src/trunk/jeeProject/hello/hello.jsp
Adding src/branches
Adding src/tags
Committed revision 1.
bpdp@bpdp-desktop:~/kerjaan/buku/geronimo$ cd
Operasi Selanjutnya:
--------------------
1. Untuk mengambil dari repository:
bpdp@bpdp-desktop:~/tmp/gembus$ svn checkout file:///home/bpdp/svnrepo/workshopJEE/trunk .
A jeeProject
A jeeProject/hello
A jeeProject/hello/WEB-INF
A jeeProject/hello/WEB-INF/web.xml
A jeeProject/hello/hellogeronimo.war
A jeeProject/hello/hello.jsp
Checked out revision 1.
bpdp@bpdp-desktop:~/tmp/gembus$ ls -la
total 16
drwxr-xr-x 4 bpdp bpdp 4096 2006-10-17 05:42 .
drwxr-xr-x 4 bpdp bpdp 4096 2006-10-17 05:41 ..
drwxr-xr-x 4 bpdp bpdp 4096 2006-10-17 05:42 jeeProject
drwxr-xr-x 7 bpdp bpdp 4096 2006-10-17 05:42 .svn
bpdp@bpdp-desktop:~/tmp/gembus$ ls -la
total 16
drwxr-xr-x 4 bpdp bpdp 4096 2006-10-17 05:42 .
drwxr-xr-x 4 bpdp bpdp 4096 2006-10-17 05:41 ..
drwxr-xr-x 4 bpdp bpdp 4096 2006-10-17 05:42 jeeProject
drwxr-xr-x 7 bpdp bpdp 4096 2006-10-17 05:42 .svn
bpdp@bpdp-desktop:~/tmp/gembus$
Catatan:
Jangan menghapus atau mengedit direktori .svn. Direktori
tersebut digunakan secara internal oleh Subversion.
2. Operasi-operasi lain:
Melihat perbedaan antara yang tersimpan di repository dengan
yang telah diedit:
bpdp@bpdp-desktop:~/tmp/gembus$ vi jeeProject/hello/hello.jsp
bpdp@bpdp-desktop:~/tmp/gembus$ svn diff
Index: jeeProject/hello/hello.jsp
===================================================================
--- jeeProject/hello/hello.jsp (revision 1)
+++ jeeProject/hello/hello.jsp (working copy)
@@ -4,6 +4,7 @@
<title>Say Hello to Geronimo!</title>
</head>
<body>
+<h1>Testing from repository</h1>
<h3>Hello, I am Geronimo, what can I do for you on ${datetime}?</h3>
</body>
</html>
bpdp@bpdp-desktop:~/tmp/gembus$
Memasukkan apa yang telah diedit tersebut ke repository:
bpdp@bpdp-desktop:~/tmp/gembus$ svn commit
Sending jeeProject/hello/hello.jsp
Transmitting file data .
Committed revision 2.
bpdp@bpdp-desktop:~/tmp/gembus$
Pada saat commit tersebut, svn akan meminta sekedar "catatan" terhadap
commit yang dilakukan. Ketikkan keterangan yang diinginkan kemudian
simpan.
Update source code sesuai dengan repository:
bpdp@bpdp-desktop:~/tmp/gembus$ svn update
At revision 2.
bpdp@bpdp-desktop:~/tmp/gembus$
Property untuk file:
Menetapkan:
bpdp@bpdp-desktop:~/tmp/gembus$ svn propset license -F /usr/share/common-licenses/BSD jeeProject/hello/hello.jsp
property 'license' set on 'jeeProject/hello/hello.jsp'
bpdp@bpdp-desktop:~/tmp/gembus$
Melihat:
bpdp@bpdp-desktop:~/tmp/gembus$ svn proplist --verbose jeeProject/hello/hello.jsp
Properties on 'jeeProject/hello/hello.jsp':
license : Copyright (c) The Regents of the University of California.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
bpdp@bpdp-desktop:~/tmp/gembus$
Setting keywords: tempatkan keyword di tempat tertentu di source code, diapit $. Untuk keperluan ini, digunakan $Date$, $Author$, $Id$, $Revision$, $HeadURL$. Setelah ditempatkan, kerjakan perintah berikut:
bpdp@bpdp-desktop:~/tmp/gembus$ svn propset svn:keywords "Date Author Id Revision HeadURL" jeeProject/hello/hello.jsp
property 'svn:keywords' set on 'jeeProject/hello/hello.jsp'
bpdp@bpdp-desktop:~/tmp/gembus$
Setelah svn commit dan svn update, source code akan terisi:
<!--
Revision : $Revision: 5 $
Author : $Author: bpdp $
Date of last committed : $Date: 2006-10-17 06:32:36 +0700 (Tue, 17 Oct 2006) $
URL : $HeadURL: file:///home/bpdp/svnrepo/workshopJEE/trunk/jeeProject/hello/hello.jsp $
ID : $Id: hello.jsp 5 2006-10-16 23:32:36Z bpdp $
-->
...
... dan seterusnya
0 comment(s):
Post a Comment