[Frugalware-darcs] vmexam: darcs2git: more error handling

VMiklos vmiklos at frugalware.org
Tue Jun 12 19:32:30 CEST 2007


Darcsweb-Url: http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=vmexam;a=darcs_commitdiff;h=20070612100343-e2957-8f02bda4a4bef4b88348744ceb596d5efc3993a8.gz;

[darcs2git: more error handling
VMiklos <vmiklos at frugalware.org>**20070612100343] {
hunk ./darcs/darcs2git 26
-	echo
-	echo "the previous contents of the target directory will be removed if"
-	echo "there is any!"
+}
+
+die()
+{
+	echo "$0: $@"
+	exit 1
hunk ./darcs/darcs2git 42
-cd `dirname $target`
-target="`pwd`/`basename $target`"
+[ -d "$src" ] || die "source dir does not exist!"
+
+cd $src
+src=`pwd`
hunk ./darcs/darcs2git 49
+cd - >/dev/null
+
+[ -d "$target" ] || die "target dir does not exist!"
+
+cd $target
+target=`pwd`
+
hunk ./darcs/darcs2git 75
-repository = $target
+repository = $myname
hunk ./darcs/darcs2git 79
-rm -rf $target darcs git $myname.*
hunk ./darcs/darcs2git 81
-cd - >/dev/null
+cd $target
+git clone $myroot/git/$myname
}


More information about the Frugalware-darcs mailing list