Tag Archives: SVN

Converting part of a svn repository to git

In moving my projects over to git, I stumbled across a troublesome issue. In one of my projects existed a folder along side trunk, tags and branches that had stuff I needed to be converted. However I wanted to convert these as individual git repositories.

So, after reading “git –help svn clone” and finding nothing to help me with this issue, I headed to the search engines. It took some time between search engines and asking some friends. As a note, Git 1.7 has sparse abilities, however I never got that far to try it out. I found out that git 1.6.4 included a new parameter which does the job just nicely.

I stumbled across this on the Tech Debug blog.

So in the end the following command is an example of what I did, with real data omitted.

This did the job exactly as I needed it to. It converted just the folder in the repository without so much of a complaint. Now that I review the git man page for svn, I do see I missed it.

When tracking multiple directories (using –stdlayout, –branches, or –tags options), git svn will attempt to connect to the
root (or highest allowed level) of the Subversion repository. This default allows better tracking of history if entire projects
are moved within a repository, but may cause issues on repositories where read access restrictions are in place. Passing
–no-minimize-url will allow git svn to accept URLs as-is without attempting to connect to a higher level directory. This option
is off by default when only one URL/branch is tracked (it would do little good).

Read More

Removing everything other than .svn

After I updated some code, I was downloading it into my local svn repository and planned to do a svn commit.  I thought I had set my FTP settings correctly to merge folders, but alas I didn’t.  What I ended up with was a broken svn working copy.

So I decided to pull another checkout in another directory.  After doing that, I needed a way to just get the .svn folders and its files out.  The quickest method I could think of would be to use my FTP client (Transmit by Panic) and this time merge the folders together.  I am sure there is a better way but I didn’t have much time to waste searching.

To accomplish this task, I needed all other files removed.  So I wrote a function to do this:

—–

function remove_non_svn($dir)
{

$files = scandir($dir);

foreach ($files as $file)
{

if ($file == ‘.’ || $file == ‘..’ || $file == ‘.DS_Store’ || $file == ‘.svn’)

continue;

if (is_dir($file) && $file != ‘.svn’)
{

remove_non_svn($dir . ‘/’ . $file);
rmdir($dir . ‘/’ . $file);

}

else

unlink($dir . ‘/’ . $file);

}

}
—–

Then I just popped that into a script and told it what folder to execute this on and it went to work.  It quickly did the job and got it all cleaned up.  Then I simply used my FTP client to merge the folders into the working copy.  After that a svn status showed the modified copies and was working.

I should note that doing this is dangerous to your svn working copy and could break things if not done right.  There also may be better methods to restore you working copy to working order.  I just didn’t have much time on my hands to search for it.

Read More

Setting up SVN

I wanted to setup SVN on my server.  Why you ask?  Well just because I can really.  The most important reason is to get my mods and other files into a repository that would also act as a backup.  I set it up on my site as I never saw the point in keeping on my own system.

Luckily, like most linux systems, on Ubuntu I can do this without breaking a sweat.  I won’t go into why I am running ubuntu.  I just felt like using Ubuntu as my server software of choice.  Although I plan on looking into Debian.

When I was going to setup, SVN I decided to set it up with dav.  Mostly because it would be easier for me to give out urls to the svn.

$ apt-get install subversion libapache2-svn

After that quickly ran and I accepted it to download the files, I was almost done.  I setup a svn repository and did an initial commit into it.  Although I had options for how to setup access, since I would be the only one committing to it, I just setup the very basic setup for access.

I had to setup my self signed SSL certificate so I could continue setting up svn.  That is as simple as running the openssl command with the correct options.  I did a google search since I was too lazy to read the manual.

$ openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/apache.pem         -keyout /etc/apache2/ssl/apache.key

Although I should of generated a 2048 key instead of the 1024 key.  After that, it was very simple to complete the setup.  I just needed to setup my virtualhost for svn and I was on my way.

<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
ServerAdmin foo@bar.com
ServerName svn.sleepycode.com
<Location /code>
DAV svn
SVNParentPath /home/svn
</Location>
</VirtualHost>

Read More

Highslide for Wordpress Plugin