From bd9e6617827818fd043452c08c606f07b78014a0 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- cervisia/cervisia-normalize_cvsroot.pl | 53 ++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 cervisia/cervisia-normalize_cvsroot.pl (limited to 'cervisia/cervisia-normalize_cvsroot.pl') diff --git a/cervisia/cervisia-normalize_cvsroot.pl b/cervisia/cervisia-normalize_cvsroot.pl new file mode 100644 index 00000000..8a96dcb8 --- /dev/null +++ b/cervisia/cervisia-normalize_cvsroot.pl @@ -0,0 +1,53 @@ +#!/usr/bin/perl + +# (copied from kdesdk/cervisia/misc.cpp) +# These regular expression parts aren't useful to check the validity of the +# CVSROOT specification. They are just used to extract the different parts of it. +$usernamerx = "([a-z0-9_][a-z0-9_-]*)?"; +$passwordrx = "(:[^@]+)?"; +$hostrx = "([^:/]+)"; +$portrx = "(:(\\d*))?"; +$pathrx = "(/.*)"; + +# concat above regexps into a single expression +$regexp = join('', ":pserver:(", $usernamerx, $passwordrx, "@)?", $hostrx, $portrx, $pathrx); + +$loginuser = getlogin || getpwuid($<); + +while(<>) +{ + # skip empty lines + next if /^$/; + + # config group for a repository? + if( /^\[Repository-(.+)\]$/ ) + { + $oldcvsroot = $1; + + # pserver CVSROOT specification? + if( $oldcvsroot =~ m/($regexp)/ ) + { + # extract username, hostname, port and path from CVSROOT + $username = $3; + $hostname = $5; + $port = $7; + $path = $8; + + # replace empty port number + $port =~ s/^$/2401/; + + # replace empty username + $username =~ s/^$/$loginuser/; + + # create normalized CVSROOT specification + $newcvsroot = join('', ":pserver:", $username, "@", $hostname, ":", $port, $path); + + print "# DELETEGROUP [Repository-$oldcvsroot]\n"; + print "[Repository-$newcvsroot]\n"; + } + + next; + } + + print $_; +} -- cgit v1.2.1