Showing posts with label subversion. Show all posts
Showing posts with label subversion. Show all posts

Friday, November 1, 2013

Tuesday, August 13, 2013

REPOST: Show and Compare Committed Files Using LOG and DIFF in Subversion

Show commited files for revision 63.

Syntax:
svn log --verbose -r <rev>
Example:
svn log --verbose -r 63

Show difference by comparing actual files. For example, show line by line difference between revision 64 against 63.

Syntax:
svn diff -r<rev-of-commit>:<rev-of-commit - 1>
Example:
svn diff -r64:63

Show the actual file version at the specific revision number:

Syntax:
svn cat -r <rev> <file> | less
Example 
svn cat -r 64 ./some_file.php | less

Reference:
http://stackoverflow.com/questions/6296284/svn-list-files-committed-for-a-revision

Wednesday, July 20, 2011

TIP: Importing your Project through SVN+SSH using a different port

1.) Edit your subversion config file
shell> sudo vim /etc/subversion/config

2.) Under "tunnels" add this
[tunnels]
ssh23 = ssh -p 23

3.) Now you can use it like this:
shell> svn import myproject svn+ssh23://username@192.100.100.100/usr/local/svn/test -m "initial import of files"

Thursday, June 30, 2011

Installing Subversion from source and mod_dav_svn in Apache

Installing Subversion from  source was one of the most frustrating thing I have done because of its dependencies so I'll summarize here a short process to do it.

1.) Download and extract Subversion from here http://subversion.apache.org/download:
shell> cd /usr/local/src
shell> wget http://subversion.tigris.org/downloads/subversion-1.6.17.tar.gz
shell> sudo tar xzvf subversion-1.6.17.tar.gz

2.) Install the dependicies and development packages (they need to be the development '-dev'). Below are the libs that it took me awhile to find:
shell> sudo apt-get install libxml-dev
shell> sudo apt-get install libssl-dev
shell> sudo apt-get install zlib1g-dev

3.) Install Subversion. I will assume that you already installed Apache, mod_ssl and signed your certificates if not refer to this other blog post of mine in installing apache:
shell> cd /usr/local/src/subversion-1.6.17.tar.gz
shell> sudo ./configure --prefix=/usr/local/lib/subversion --with-apxs=/usr/local/apache2/bin/apxs --with-ssl

NOTES: Some installation that I read from other websites suggests you to include neon, apr, apr-utils like this for example:
shell> sudo ./configure --prefix=/usr/local/lib/subversion --with-apxs=/usr/local/apache2/bin/apxs --with-apr=PATH-TO-APR --with-apr-util=PATH-TO-UTIL --with-neon=PATH-TO-NEON --with-openssl=PATH-TO-OPENSSSL --with-ssl

You dont have to do the above! Infact when I did that build, that's when my headache started because of the dependencies. You also do not need to install the individual packages that are required namely apr, apr-utils, and neon. The install script will automatically search for the libraries included with the tar package you downloaded.

Then after configure finishes:
shell> sudo make
shell> sudo make install

This will install the mod_dav_svn.so and mod_authz_svn.so in the modules directory of your Apache installation.

EXTRAS: Some stuffs that I discovered along the way (just sharing :P ):

- This will return the list of files that are using this library that you installed through apt-get. In other words, the installed file locations:
shell> sudo dpkg -L libssl-dev

- Will look at your apt-get history and return which packages you have installed in the past
shell> grep -nwH install /var/log/dpkg.log ;: look at installs
shell> grep -nwH removes /var/log/dpkg.log ;: look at removes

- Download the source from the package distribution then install it yourself from source instead.
shell> sudo apt-get source libapache2-svn ;: will download and extract the source files
shell> sudo apt-get build-dep libapache2-svn ;: this will install all the dependencies
shell> cd subversion-1.6.12dfsg
shell> sudo ./configure --prefix=PATH --with-apxs=PATH-TO-APXS-FILE

Thats it!

Thursday, June 23, 2011

Notes on Setting up Subversion in Ubuntu

Quick walkthrough on setting up subversion in your own server. I will use WebDAV in order to communicate with Apache and quick setup of Samba in case you want to look at your repository in Windows.

1.) Install subversion
shell> sudo apt-get install subversion

2.) Add a subversion group:
shell> sudo groupadd subversion

3.)  Add your username and www-data to the group subversion:
shell> sudo gpasswd -a username subversion
shell> sudo gpasswd -a www-data subversion

4.) Create your repository. I chose mine to be created in /usr/local
shell> cd /usr/local
shell> mkdir svn/myproject ;: this is the name of my repository
shell> chown -R www-data:subversion svn/myproject
shell> chmod -R g+rws svn/myproject
shell> cd svn
shell> svnadmin create myproject ;: for organizational purposes, svn dir will hold different projects

5.) Import our project. I choose to create a trunk here.
The project here is empty or nonexisting yet. Also, you need to go out outside the /usr/local/svn directory
shell> cd /home/projects
shell> mkdir -p myproject/trunk
shell> svn import myproject file:///usr/local/svn/myproject -m "Initial import"

This will create project "myproject" in /svn/myproject thus creating you a directory structure in svn repo like /svn/myproject/trunk

5b.) If you need to import an existing project with existing files inside it do:
shell> cd /home/superman/www/myproject ;: assume this is my project location
shell> svn import . file:///usr/local/svn/myproject/trunk -m "Initial import of project Superproject"

Notice that I created a trunk directory via import command

6.) Lets install the WebDAV SVN module in apache.
shell> sudo apt-get  libapache2-svn
shell> sudo vim /etc/apache2/mods-available/dav_svn.conf

7.) Add this:
  <Location /svn/myproject>
     DAV svn
     SVNPath /usr/local/svn/myproject
     AuthType Basic
     AuthName "SVN Repo"
     AuthUserFile /etc/subversion/passwd
     <LimitExcept GET PROPFIND OPTIONS REPORT>
        Require valid-user
     </LimitExcept>
  </Location>

8.) Now lets create the passwd file
shell> sudo htpasswd -c /etc/subversion/passwd username ;: -c to create the file
shell> sudo htpasswd /etc/subversion/passwd batman ;: add another user. no -c this time
shell> sudo apache2ctl restart

9.) NOTES: If you happen to have permissions problem like if you are using tortoise and trying to commit but wont let you do it do:
shell> sudo gpassswd -a www-data subversion :; make apache part of the group
shell> cd /usr/local/svn/myproject :; make sure myproject is owned by www-data
shell> sudo chown -R www-data:subversion . :; we did this earlier but just making sure

10.) OPTIONAL. If you have samba installed and want to add /usr/local/svn
shell>sudo vim /etc/samba/smb.conf
Then add this:
[svn]
   path = /usr/local/svn
   writeable = yes
   browseable = yes
   valid users = username
   guest ok = no

11.) Checking out your project
shell> cd /home/superman/projects/www
shell> mkdir myproject
shell> svn checkout file:///usr/local/svn/myproject/trunk myproject

12.) When checking out in Windows using Tortoise SVN use:
http://[ip of svn server]/svn/myproject/trunk 

The above link is the one to use also for viewing your SVN tree structure via a web browser and will only work if you install the WebDAV module in Apache.