Update web directory after a SVN commit: the final solution

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 23-08-2010

0

Hi,

i wrote about this in the past (you can see some post at the end) but i’m writing again as i found the perfect solution to make a SVN update after a commit to a web directory.

the difference between the old and this new one, is that the old make a svn update in all the working copy, something like that is not a problem if you have some files, but when you have like 100K files, it takes too much time and resources. so the idea was to get a list of changed directories after each commit and run a svn update on each directory.

for this i used some bash scripting and a C program (the C program is needed when the files do not belong to the user who execute the post-commit script).

in the post-commit script put something like this:

svnlook dirs-changed /path/to/your/repository > /tmp/dirschanged

while read line
do
/path/to/C/Binary/updateFolder $line
done < “/tmp/dirschanged”

and save it. remember that after the svnlook (that is what return the list of directories that has been modified)  and before the while, you can use sed to change any path of your repository and convert it into a valid full path in your web directory.

then, create a .c file and paste this code to make the binary:

#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
int main(int argc, char *argv[])
{

int i;
for (i = 1; i < argc; i++)  /* Skip argv[0] (program name). */
{

printf(“making update to  %s \n”,argv[i]);
execl(“/usr/bin/svn”, “svn”, “update”,argv[i],
(const char *) NULL);
}
exit(0);

}

compile and set a chmod +s, and is done :D . the binary will accept any amount of arguments as paths to run the svn update, anyway i’ll recomend to make 1 at time, so you have more control of it.

i know that this code could be improved, maybe using less bash scripting and more C coding, but i’m not good as before in C, so for me was more easy to make the loop and event the replacements with sed in the bash scripts.

i hope this help you in some way

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Known problem with subversion and windows 7

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 03-08-2010

0

Hi,

in the process of the migration of the server have come the moment when my boss needed to checkout a copy of the repository. i have checked several times the subversion installation and i made like 3 checkouts before even start. my big mistake have do not made a complete checkout of the repository in a windows machine (and more specifically, a windows 7 machine), this have resulted in a very large session of debugging, so to avoid you hours of work, i’m here to give you the solution to the most normal problems.

1) Error: The file or directory is corrupted and unreadable.

as the subversion FAQ says, this could be for 2 reason, a antivirus program or the windows indexing service. this basically happen why the antivirus or the windows indexing service move the downloaded file, so subversion can’t find it. in the case of my boss, the only solution with the antivirus (kapersky) was to disable it. in case of the windows indexing service, is not enough to disable it completely, you need to follow this steps under the folder where you are making the checkout.

* Click the start menu button, then click in the text box to begin a search
* Type in “windows index”
* Click on “Indexing Options” that should come up in the search
* When the Indexing Options box comes up, Click on the Modify button. This will pop up an Indexed Locations dialog, where you should see a list of some “locations”, with your hard drive(s) being in the list.
* Expand the desired hard drive, down to the root folder of the files you’re using SVN with, and make sure the box is unchecked. Also note that the hard drive will most likely be collapsed, and will have its box unchecked, even though once you expand it, you may find checked boxes.

2) Error: The system cannot find the file specified.

this is usually why you have 2 files with the same name with the only difference is some letter in uppercase/lowercase. the problem is that windows have a case-insensitive file system, so for windows, those files are 1 and for subversion no. the only solution is to rename one of the files. for this, if you already have a checkout made in a linux box, you can delete and make a commit. if not, with tortoise SVN you can use the repo broswer to erase directly. after that, is probably you need to delete the folder and make a update again (and maybe a cleanup in the middle)

3) Error: REPORT of ‘/svn/!svn/vcc/default’: Could not read chunk size: connection was closed by the server

i don’t know why this happen, just trying a update have continue the checkout

4) Server sent unexpected return value (413 Request Entity Too Large) in response

the first error that need to be fixed on the server, only happened on the windows 7, dunno why. basically is a apache limit at the upload of XML info, to fix that, edit your httpd.conf (usually located on /etc/httpd/conf/httpd.conf) and add this line:

LimitXMLRequestBody 0

and of course restart httpd/apache

i hope this will help you in some way :)

Regards,

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Change repository URL if svn switch fails

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 05-04-2010

0

Hi,

recently i made some changes in a server where a svn was hosted, part of the changes was the change of the URL, so here i was having problem to commit the changes from my working copy. i tried to make a switch and a switch –relocate but any of them worked, some times is says the repository isn’t the same or some times is executed but the url wasn’t changed.

if you are in a hurry and can’t figure out how to make it work, just execute this command:

find /path/to/your/working/copy/  -type f -name ‘entries’ -exec sed -i ’s|http://url/of/your/old/repository/|http://url/of/your/new/repository/|g’ {} \;

basically that going to replace all the url appearance of your old repository url to the new one, if you have branches or subfolders, maybe you need to execute this several times changing the strings, open a entries file inside the .svn folders to figure it out :)

i hope it help you :D

Regards,

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Update web directory after commit in SVN

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 05-03-2010

0

Hi,

some new tips about subversion :D

if you need to update a web directory after someone make a commit just follow this guide: http://subversion.apache.org/faq.html#website-auto-update

i wanted to post this why it take me some time to figure out that a simple bash script don’t going to work and even if it worked with some tricks, i always getting a merge and not an update of the repository :P

some thing that the faq don’t mention is how to compile the program, if you are a newbie and don’t know how to do it, just run this command

gcc your_file_name.c -o your_binary_name

i hope it helps :D

Regards.

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Subversion with Cpanel and WHM

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 26-02-2010

0

Hi,

recently i needed to use subversion, i never used a control version before, so i proceed to look info about it.

the environment where need to be installed was a vps with centos 5 and WHM/Cpanel.

like cpanel dont install apache using yum the “easy way” can’t be possible.

searching in internet i found this useful guide: http://www.edugeek.net/forums/nix/26101-subversion-whm-cpanel-11-a.html all worked perfectly :D

i hope it helps :D

Regards,

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]