[Portland] xdg-utils upstream status

Jonathan Nieder jrnieder at gmail.com
Thu Sep 30 14:24:46 PDT 2010


Fathi Boudra wrote:

> ok, let's move to git

Something like the following should do it.

Thoughts?  Improvements?

mkdir /tmp/conversion &&
cd /tmp/conversion &&
apt-get install cvs2svn git &&
cat >authors.txt <<\END_AUTHORS_DOT_TXT &&
bastian = Waldo Bastian <waldo.bastian at intel.com>
bryce = Bryce Harrington <bryce at bryceharrington.org>
cworth = Carl Worth <cworth at cworth.org>
fabo = Fathi Boudra <fabo at freedesktop.org>
jwhite = Jeremy White <jwhite at codeweavers.com>
krake = Kevin Krammer <kevin.krammer at gmx.at>
llunak = Lubos Lunak <l.lunak at suse.cz>
micke = Mikael Hallendal <micke at imendio.com>
mr = Mikhail Ramendik <mr at ramendik.ru>
norbertf = Norbert Frese <nf2 at scheinwelt.at>
rdieter = Rex Dieter <rdieter at math.unl.edu>
whipple = Tom Whipple <tw at tomwhipple.com>
importer = cvs2git <cvs2git>
END_AUTHORS_DOT_TXT

cat >portland-git.sh <<\END_PORTLAND_GIT_SCRIPT &&
#!/bin/sh
set -e
authors_file=$(pwd)/authors.txt
export authors_file
fetch_cvs () {
	rsync -avzP freedesktop.org::cvs/portland .
}
convert_from_cvs () {
	git init --bare portland-git.git &&
	cvs2git --blobfile=/dev/fd/3 --dumpfile=/dev/fd/3 \
		--username=importer --encoding=latin-1 --encoding=utf-8 \
		portland 3>&1 >&2 |
	(
		cd portland-git.git &&
		git fast-import &&
		git gc --aggressive
	)
}
delete_orig_refs () {
	# clean up after filter-branch.
	eval "$(
		git for-each-ref --shell \
			--format='git update-ref -d %(refname) &&' \
			refs/original &&
		echo :
	)"
}
clean_tags () {
	eval "$(
		git for-each-ref --shell --format='
				ref=%(refname) &&
				new_ref=$(echo "$ref" |
					sed -e "
						s/RELEASE_TP/tmp/
						s/RELEASE_/v/
						s/_BETA_/-beta/
						s/_RC/-rc/
						s/_/./g
					"
				) &&
				echo "$ref -> $new_ref" &&
				git update-ref -d "$ref" &&
				git update-ref "$new_ref" %(objectname) &&
			' &&
		echo :
	)"
}
clean_repo () {
	git filter-branch --env-filter '
			get_name () {
				grep "^$1 =" "$authors_file" |
				sed "s/^.*= \(.*\) <.*>$/\1/"
			}

			get_email () {
				grep "^$1 =" "$authors_file" |
				sed "s/^.*= .* <\(.*\)>$/\1/"
			}

			GIT_AUTHOR_NAME=$(get_name $GIT_COMMITTER_NAME) &&
			GIT_AUTHOR_EMAIL=$(get_email $GIT_COMMITTER_NAME) &&
			GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME &&
			GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL &&
			export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL &&
			export GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL
		' -- --all &&
	delete_orig_refs &&
	clean_tags &&
	git gc --aggressive
}
extract_subdir () {
	git clone --mirror portland-git.git "$1.git" &&
	(
		cd $i.git &&
		git remote rm origin &&
		git filter-branch --subdirectory-filter "portland/$i" \
			--prune-empty -- --all &&
		delete_orig_refs
	)
}
fetch_cvs &&
convert_from_cvs &&
( cd portland-git.git && clean_repo ) &&
for i in dapi-dbus dapi libxdg-vfs xdg-utils
do
	extract_subdir $i
done
END_PORTLAND_GIT_SCRIPT

sh portland-git.sh


More information about the Portland mailing list