Skip to content


การติดตั้ง svn

หลังจากหัวหมุนกับการใช้งานและการติดตั้ง svn&trac อยู่ซะตั้งนาน แต่ตอนนี้ก็ใช้งานได้แล้วครับ ก้เลยเอาไปเขียนใส่ไว้ใน wiki ของตัวเองซะ ที่นี่ครับ

จาก WikiBall

Subversion เป็นโปรแกรมที่ใชัสร้าง และจัดการ version ของ source code ของเรา
สามารถดูการติดตั้งร่วมกับ apache ได้ จาก SVN+Trac+apache2

เนื้อหา



การติดตั้ง

สำหรับ Ubuntu

$ sudo apt-get install apt-get install subversion


การใช้งาน


สร้าง repository

ตัวอย่างการสร้าง

$ svnadmin create /var/svn/repository/example


นำเข้า (import) project

$ svn import /path/to/projectexample file:///var/svn/repository/example/examplev1 -m"initial import" 


คู่มือการใช้งาน

  1. SVN Command line 1
  2. SVN Command line 2
  3. คู่มือการใช้งาน Subversion
  4. คู่มือการใช้งาน RapidSVN


การ config svnserve

svnserve คือ daemon สำหรับ svn โดยที่เราสามารถ login ผ่านทาง SVN client ต่างๆ โดยผ่านโปรโตคอล svn หรือถ้าต้องการเข้าผ่าน apache SVN+Trac+apache2 (ง่ายกว่า)

svn://hostname:port/repos

ทดสอบรับ daemon แบบ forground โดยใช้คำสั่ง

$ sudo svnserve -d --listen-port=port --foreground -r  root/path

เรียกเป็น http ใน browser ถ้าขึ้นในลักษณะนี้แสดงว่ารันได้แล้ว

( success ( 1 2 ( ANONYMOUS ) ( edit-pipeline svndiff1 absent-entries ) ) )

ตัว svnserve นี้จะไม่มี file ใน init.d มาให้เราจะต้องสร้างเองดังนี้
สื่อ:svnserve.tar.gz

อย่าลืมตั้งค่า authentication ใน /path/to/repository/conf


SVN Client

สำหรับที่ผู้ที่ไม่อยากใช้ SVN แบบ command line ใช้แบบ command line ไม่เป็น(เช่นเดียวกับผม) จะมี GUI กระต่ายกับเต่า ให้เลือกใช้ได้ดังนี้

  1. TortoiseSVN-(Windows)
  2. RapidSVN-(Ubuntu+Mac+Windows)

ref : http://agaricdesign.com/note/subversion-client-ubuntu-anything-tortoisesvn


svn service file

#!/bin/sh -e
#
# svnserve - brings up the svn server so anonymous users
# can access svn
#

# Get LSB functions
. /lib/lsb/init-functions
. /etc/default/rcS

SVNSERVE=/usr/bin/svnserve
SVN_USER=svn
SVN_GROUP=svn
SVN_REPO_PATH=/var/svn/repository/
SVN_PORT=8000

# Check that the package is still installed
[ -x $SVNSERVE ] || exit 0;

case "$1" in
	start)
		log_begin_msg "Starting svnserve..."
		umask 002
		if start-stop-daemon --start \
		--chuid $SVN_USER:$SVN_GROUP \
		--exec $SVNSERVE \
		-- -d --listen-port=$SVN_PORT -r $SVN_REPO_PATH; then
			log_end_msg 0
		else
			log_end_msg $?
		fi
	;;

	stop)
		log_begin_msg "Stopping svnserve..."
		if start-stop-daemon --stop --exec $SVNSERVE; then
		log_end_msg 0
		else
		log_end_msg $?
		fi
	;;

	restart|force-reload)
		"$0" stop && "$0" start
	;;

	*)
	echo "Usage: /etc/init.d/svnserve {start|stop|restart|force-reload}"
		exit 1
	;;
esac

exit 0


Troubleshooting

  • import ไม่ได้
svn: Unable to open an ra_local session to URL
svn: Unable to open repository 'file:///Development/subversion/foo'

เหตุการณ์ดังกล่าวเกิดขึ้นได้ 2 กรณี คือ

 #path ดังกล่าวไม่สามารถเข้าไปได้ เช่น ติด permission
 #ใส่ path กับ URL สรับกัน


อื่นๆ ที่เกี่ยวข้อง

รับข้อมูลจาก (Reference) :

จาก WikiBall : http://wiki.memoball.info/index.php/Subversion

Posted in Trac & SVN. Tagged with , .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.