Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-4 of 4 total  RSS 

Remove Deleted Files From Git

// Via http://www.jamesrobey.com/bash-script-to-remove-deleted-files-from-git/

for i in `git status | grep deleted | awk '{print $3}'`; do git rm $i; done

Checkout a Git clone of an SVN repository in parent folder

Here is a quick executable cmd that you run inside a folder checked out with Subversion. It will clone the repository using Git into the parent folder as <projname>.git

Stick this code into ~/bin/gitify and add ~/bin to your path:

#!/usr/bin/env ruby -wKU

# get svn info location
svnurl = `svn info | grep "^URL:"`.gsub('URL: ','').chomp

# project = basename
project = File.basename(Dir.pwd)

puts cmd = "git-svn clone #{svnurl} ../#{project}.git"

`#{cmd}`

backup subversion repository over email

#!/bin/bash
#
# $Id: repodiff 3 2006-09-21 18:48:39Z sevkin $
#
# subversion repository incremental backup over e-mail
#
# (c) 2006 Vsevolod Balashov under terms of GNU GPL v.2 or later

SVNROOT=/var/svn
EMAIL=your@email.here
STORE=`mktemp -d`
GPGCRYPT=n

for REPO in `ls $SVNROOT`; do 
	REPOPATH=$SVNROOT/$REPO;
	if [ -r $REPOPATH/youngest ]; then
		LATEST=`cat $REPOPATH/youngest`
		YOUNGEST=`svnlook youngest $REPOPATH`
		if [ $LATEST -lt $YOUNGEST ]; then
			svnadmin dump $REPOPATH --incremental -r $LATEST:$YOUNGEST >$STORE/$REPO 2>/dev/null
		fi
	else
		svnadmin dump $REPOPATH --incremental >$STORE/$REPO 2>/dev/null
	fi 
	echo $YOUNGEST >$REPOPATH/youngest 
done

if [ `ls $STORE | wc -w` -gt 0 ]; then
	BACKUP=repodiff_`date -u +%Y%m%d%H%M%S`.tar.bz2
	ATTACH=$STORE/../$BACKUP
	tar  -C $STORE -cjf $ATTACH .
	if [ $GPGCRYPT = y ]; then
		gpg -e -r $EMAIL $ATTACH
		ATTACH=$ATTACH.gpg
	fi
	echo "." | mutt -c $EMAIL -a $ATTACH -s "repository incremental backup"
	rm -f $ATTACH
fi

rm -rf $STORE

Subversion service for low-load (personal?) sources repository

Create separate user and insert svnserve into inetd.

# useradd -g root -s /bin/false -d /dev/null -c "SubVersion Daemon" svnserve
# mkdir /var/svn
# chown -R svnserve /var/svn
# update-inetd --add 'svn\tstream\ttcp\tnowait\tsvnserve\t/usr/sbin/tcpd\t/usr/bin/svnserve --inetd --root /var/svn'


/var/svn - root of repository.
update-inetd - standart tool in debian and ubuntu linux distros

You must run svnadmin as svnserve user for manage your repository

$ sudo sudo -u svnserve svnadmin <command>


« Newer Snippets
Older Snippets »
Showing 1-4 of 4 total  RSS