From 0f7db62d9229aeaf87ab13fb010be797b375ff5a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 2 Apr 2010 20:16:08 -0600 Subject: add a tree plugin to rvs, but I made a ton of other changes to get things working and facilitate this --- rvs/plugins/comments/bin/comment.sh | 14 +++++----- rvs/plugins/comments/bin/commit.sh | 5 ++-- rvs/plugins/comments/info.mk.in | 2 ++ rvs/plugins/files/bin/blob-gethash.sh | 26 ++++++++++++++++++ rvs/plugins/files/bin/blob-gettype.sh | 26 ++++++++++++++++++ rvs/plugins/files/bin/commit.d.sh | 20 +++++++++----- rvs/plugins/files/bin/commit.f.sh | 11 ++++---- rvs/plugins/files/bin/commit.sh | 6 ++--- rvs/plugins/files/bin/file-gettype.sh | 39 +++++++++++++++++++++++++++ rvs/plugins/files/bin/get.d.sh | 23 +++++++++------- rvs/plugins/files/bin/get.f.sh | 12 ++++----- rvs/plugins/files/bin/get.sh | 16 +++++------ rvs/plugins/files/bin/gettype.sh | 39 --------------------------- rvs/plugins/files/bin/ls.sh | 50 +++++++++++++++++++++++++++++++++++ rvs/plugins/files/info.mk.in | 2 ++ rvs/plugins/files/lib/stdio.sh | 18 +++++++++---- rvs/plugins/tags/bin/commit.sh | 25 ++++++++++++++++++ rvs/plugins/tags/info.mk.in | 4 ++- rvs/plugins/tree/bin/addparent.d.sh | 44 ++++++++++++++++++++++++++++++ rvs/plugins/tree/bin/addparent.f.sh | 27 +++++++++++++++++++ rvs/plugins/tree/bin/addparent.sh | 32 ++++++++++++++++++++++ rvs/plugins/tree/bin/delparent.f.sh | 34 ++++++++++++++++++++++++ rvs/plugins/tree/info.mk.in | 5 ++++ rvs/wrapper/rvs.sh | 4 ++- 24 files changed, 392 insertions(+), 92 deletions(-) create mode 100644 rvs/plugins/files/bin/blob-gethash.sh create mode 100644 rvs/plugins/files/bin/blob-gettype.sh create mode 100644 rvs/plugins/files/bin/file-gettype.sh delete mode 100644 rvs/plugins/files/bin/gettype.sh create mode 100644 rvs/plugins/files/bin/ls.sh create mode 100644 rvs/plugins/tree/bin/addparent.d.sh create mode 100644 rvs/plugins/tree/bin/addparent.f.sh create mode 100644 rvs/plugins/tree/bin/addparent.sh create mode 100644 rvs/plugins/tree/bin/delparent.f.sh create mode 100644 rvs/plugins/tree/info.mk.in diff --git a/rvs/plugins/comments/bin/comment.sh b/rvs/plugins/comments/bin/comment.sh index fbe5689..0be99e5 100644 --- a/rvs/plugins/comments/bin/comment.sh +++ b/rvs/plugins/comments/bin/comment.sh @@ -1,7 +1,7 @@ #!/bin/sh -name='rvs @ID@ commit' +name='comment' ver=0.1 -# Copyright (C) 2009-2010 Luke Shumaker +# Copyright (C) 2010 Luke Shumaker # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -17,8 +17,10 @@ ver=0.1 # along with this program; see the file COPYING. # If not, see . -if [ "$RVS_LEVEL" = '0' ]; then - id=`cat $TMPDIR/commit/files` - "$RVS" tag "$id" wch -fi +usage="usage: $RVS $name ID" +id="${1?"$usage"}" + +file="$REPO/@ID@/$id" +mkdir -p "`dirname "$file"`" +editor "$file" >> /dev/stderr diff --git a/rvs/plugins/comments/bin/commit.sh b/rvs/plugins/comments/bin/commit.sh index 7a6e619..4ef2c5d 100644 --- a/rvs/plugins/comments/bin/commit.sh +++ b/rvs/plugins/comments/bin/commit.sh @@ -1,7 +1,7 @@ #!/bin/sh name='rvs @ID@ commit' ver=0.1 -# Copyright (C) 2009-2010 Luke Shumaker +# Copyright (C) 2010 Luke Shumaker # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -18,7 +18,8 @@ ver=0.1 # If not, see . if [ "$RVS_LEVEL" = '0' ]; then - id=`cat $TMPDIR/commit/files` + id=`cat "$TMPDIR/commit/files"` "$RVS" comment "$id" fi +cat "$TMPDIR/commit/files" diff --git a/rvs/plugins/comments/info.mk.in b/rvs/plugins/comments/info.mk.in index 7aa15d1..144b832 100644 --- a/rvs/plugins/comments/info.mk.in +++ b/rvs/plugins/comments/info.mk.in @@ -1,3 +1,5 @@ name = comments ver = 0.1 priority = 1 +depends = >files + diff --git a/rvs/plugins/files/bin/blob-gethash.sh b/rvs/plugins/files/bin/blob-gethash.sh new file mode 100644 index 0000000..b790d28 --- /dev/null +++ b/rvs/plugins/files/bin/blob-gethash.sh @@ -0,0 +1,26 @@ +#!/bin/sh +name='blob-gethash' +ver=0.9 +# Copyright (C) 2009-2010 Luke Shumaker +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +. "$LIBDIR/@ID@/stdio" + +usage="ID" +id="`getvar "$1"`" + +echo $id | sed 's:.*/::' + diff --git a/rvs/plugins/files/bin/blob-gettype.sh b/rvs/plugins/files/bin/blob-gettype.sh new file mode 100644 index 0000000..3378506 --- /dev/null +++ b/rvs/plugins/files/bin/blob-gettype.sh @@ -0,0 +1,26 @@ +#!/bin/sh +name='blob-gettype' +ver=0.9 +# Copyright (C) 2009-2010 Luke Shumaker +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +. "$LIBDIR/@ID@/stdio" + +usage="ID" +id="`getvar "$1"`" + +echo $id | sed 's:/.*::' + diff --git a/rvs/plugins/files/bin/commit.d.sh b/rvs/plugins/files/bin/commit.d.sh index 0da1efb..d7e48f9 100644 --- a/rvs/plugins/files/bin/commit.d.sh +++ b/rvs/plugins/files/bin/commit.d.sh @@ -1,7 +1,7 @@ #!/bin/sh -name='rvs files commit.d' +name='commit.d' ver=0.9 -# Copyright (C) 2009 Luke Shumaker +# Copyright (C) 2009-2010 Luke Shumaker # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -19,14 +19,22 @@ ver=0.9 . "$LIBDIR/@ID@/stdio" -# commit.d DIRNAME -dir="${1?'usage: commit.d DIRNAME'}" +usage="DIRNAME" +dir="`getvar "$1"`" + tmp=`mktemp` +t=' '; cd "$dir" for file in *; do - id=`"$RVS" commit "$file"` - echo "$file:$id" >> "$tmp" + p="`stat "$file" -c'%a' `" # permissions + o="`stat "$file" -c'%u (%U)'`" # owner + g="`stat "$file" -c'%g (%G)'`" # group + i="`"$RVS" commit "$file"`" # ID + n="$file" # name + + # %p %o %g %i %n + echo "$p$t$o$t$g$t$i$t$n" >> "$tmp" done "$RVS" commit.f "$tmp" d diff --git a/rvs/plugins/files/bin/commit.f.sh b/rvs/plugins/files/bin/commit.f.sh index 17de155..c27005b 100644 --- a/rvs/plugins/files/bin/commit.f.sh +++ b/rvs/plugins/files/bin/commit.f.sh @@ -1,7 +1,7 @@ #!/bin/sh -name='rvs files commit.f' +name='commit.f' ver=0.9 -# Copyright (C) 2009 Luke Shumaker +# Copyright (C) 2009-2010 Luke Shumaker # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -17,11 +17,10 @@ ver=0.9 # along with this program; see the file COPYING. # If not, see . -#. "$LIBDIR/@ID@/stdio" +. "$LIBDIR/@ID@/stdio" -# commit.f FILENAME -usage="usage: $RVS commit.f FILENAME [PREFIX]" -file="${1?"$usage"}" +usage="FILENAME [PREFIX]" +file="`getvar "$1"`" prefix="${2-f}" hash=`sha1sum $file | sed "s/ .*$//"` diff --git a/rvs/plugins/files/bin/commit.sh b/rvs/plugins/files/bin/commit.sh index e8db1eb..0bb8233 100644 --- a/rvs/plugins/files/bin/commit.sh +++ b/rvs/plugins/files/bin/commit.sh @@ -1,5 +1,5 @@ #!/bin/sh -name='rvs filecontent commit' +name='commit' ver=0.9 # Copyright (C) 2009-2010 Luke Shumaker # @@ -19,9 +19,9 @@ ver=0.9 . "$LIBDIR/@ID@/stdio" -# commit FILE +usage="[FILE]" file=${1-.} # take arg1 as the file, default to the current directory -type=`"$RVS" gettype "$file"` +type=`"$RVS" file-gettype "$file"` "$RVS" "commit.$type" "$file" diff --git a/rvs/plugins/files/bin/file-gettype.sh b/rvs/plugins/files/bin/file-gettype.sh new file mode 100644 index 0000000..2a1e0ca --- /dev/null +++ b/rvs/plugins/files/bin/file-gettype.sh @@ -0,0 +1,39 @@ +#!/bin/sh +name='file-gettype' +ver=0.9 +# Copyright (C) 2009-2010 Luke Shumaker +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +. "$LIBDIR/@ID@/stdio" + +usage="FILE" +file="`getvar "$1"`" + +if [ ! -e "$file" ]; then + fatal "file \`$file' does not exist"; +else + type='' + for check in "$ETCDIR/@ID@/"*; do + type=`"$check" "$file"` + if [ -n "$type" ]; then break; fi + done + if [ -n "$type" ]; then + echo "$type" + else + fatal "cannot handle file type of \`$file'" + fi +fi + diff --git a/rvs/plugins/files/bin/get.d.sh b/rvs/plugins/files/bin/get.d.sh index 1a001d3..89bd92a 100644 --- a/rvs/plugins/files/bin/get.d.sh +++ b/rvs/plugins/files/bin/get.d.sh @@ -1,7 +1,7 @@ #!/bin/sh -name='rvs files get.d' +name='get.d' ver=0.9 -# Copyright (C) 2009 Luke Shumaker +# Copyright (C) 2009-2010 Luke Shumaker # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -17,11 +17,11 @@ ver=0.9 # along with this program; see the file COPYING. # If not, see . -#. "$LIBDIR/@ID@/stdio" +. "$LIBDIR/@ID@/stdio" -usage="usage: $RVS get.d DIRNAME ID" -dir="${1?"$usage"}" - id="${2?"$usage"}" +usage="DIRNAME ID" +dir="`getvar "$1"`" + id="`getvar "$2"`" tmp=`mktemp` "$RVS" get.f "$tmp" "$id" @@ -32,9 +32,14 @@ mkdir -p "$dir" cd "$dir" rm -rf ./* while read line; do - _id="`echo "$line" | sed 's/^.*://'`" - _name="`echo "$line" | sed 's@:'"$_id"'$@@'`" - "$RVS" get "$_name" "$_id" + p="`echo "$line" | cut -f1`" # permissions + o="`echo "$line" | cut -f2`" # owner + g="`echo "$line" | cut -f3`" # group + i="`echo "$line" | cut -f4`" # ID + n="`echo "$line" | cut -f5-`" # name + "$RVS" get "$n" "$i" + #chmod "$p" "$n" + #chown "$o:$g" "$n" done < "$tmp" rm "$tmp" diff --git a/rvs/plugins/files/bin/get.f.sh b/rvs/plugins/files/bin/get.f.sh index b137911..00508ab 100644 --- a/rvs/plugins/files/bin/get.f.sh +++ b/rvs/plugins/files/bin/get.f.sh @@ -1,7 +1,7 @@ #!/bin/sh -name='rvs files get.f' +name='get.f' ver=0.9 -# Copyright (C) 2009 Luke Shumaker +# Copyright (C) 2009-2010 Luke Shumaker # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -17,11 +17,11 @@ ver=0.9 # along with this program; see the file COPYING. # If not, see . -#. "$LIBDIR/@ID@/stdio" +. "$LIBDIR/@ID@/stdio" -usage="usage: $RVS get.f FILENAME ID" -name="${1?"$usage"}" - id="${2?"$usage"}" +usage="FILENAME ID" +name="`getvar "$1"`" + id="`getvar "$2"`" install -T "$REPO/@ID@/$id" "$name" diff --git a/rvs/plugins/files/bin/get.sh b/rvs/plugins/files/bin/get.sh index d3f046c..639ac57 100644 --- a/rvs/plugins/files/bin/get.sh +++ b/rvs/plugins/files/bin/get.sh @@ -1,7 +1,7 @@ #!/bin/sh -name='rvs filecontent get' +name='get' ver=0.9 -# Copyright (C) 2009 Luke Shumaker +# Copyright (C) 2009-2010 Luke Shumaker # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -17,16 +17,16 @@ ver=0.9 # along with this program; see the file COPYING. # If not, see . -#. "$LIBDIR/@ID@/stdio" +. "$LIBDIR/@ID@/stdio" -usage="usage: $RVS get FILENAME ID" -name="${1?"$usage"}" - id="${2?"$usage"}" +usage="FILENAME ID" +name="`getvar "$1"`" + id="`getvar "$2"`" file="$REPO/@ID@/$id" -type="`echo $id | sed 's:/.*::'`" -#hash="`echo $id | sed 's:.*/::'`" +type="`"$RVS" blob-gettype "$id"`" +#hash="`"$RVS" blob-gethash "$id"`" "$RVS" "get.$type" "$name" "$id" diff --git a/rvs/plugins/files/bin/gettype.sh b/rvs/plugins/files/bin/gettype.sh deleted file mode 100644 index 84eb9da..0000000 --- a/rvs/plugins/files/bin/gettype.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -name='rvs @ID@ gettype' -ver=0.9 -# Copyright (C) 2009-2010 Luke Shumaker -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -. "$LIBDIR/@ID@/stdio" - -usage="usage: $RVS gettype FILE" -file=${1?"$usage"} - -if [ ! -e "$file" ]; then - fatal "file \`$file' does not exist"; -else - type='' - for check in "$ETCDIR/@ID@/"*; do - type=`"$check" "$file"` - if [ -n "$type" ]; then break; fi - done - if [ -n "$type" ]; then - echo "$type" - else - fatal "cannot handle file type of \`$file'" - fi -fi - diff --git a/rvs/plugins/files/bin/ls.sh b/rvs/plugins/files/bin/ls.sh new file mode 100644 index 0000000..ae225cf --- /dev/null +++ b/rvs/plugins/files/bin/ls.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +name='ls' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +. "$LIBDIR/@ID@/stdio" + +usage="DIR_ID [FORMAT]" +id="`getvar "$1"`" +form="${2-%p\t%o\t%g\t%n\t%i}" + +# %p - permissions +# %o - owner +# %g - group +# %i - blob id +# %n - name +# \t - a tab char + +tmp="`mktemp`" +"$RVS" get.f "$tmp" "$id" + +while read line; do + p="`echo "$line" | cut -f1`" + o="`echo "$line" | cut -f2`" + g="`echo "$line" | cut -f3`" + i="`echo "$line" | cut -f4`" + n="`echo "$line" | cut -f5-`" + echo "$form" | sed \ + -e 's:\\t:\t:g' \ + -e "s:%p:${p/':'/'\:'}:g" \ + -e "s:%o:${o/':'/'\:'}:g" \ + -e "s:%g:${g/':'/'\:'}:g" \ + -e "s:%i:${i/':'/'\:'}:g" \ + -e "s:%n:${n/':'/'\:'}:g" +done < "$tmp" + diff --git a/rvs/plugins/files/info.mk.in b/rvs/plugins/files/info.mk.in index 7552306..fac7862 100644 --- a/rvs/plugins/files/info.mk.in +++ b/rvs/plugins/files/info.mk.in @@ -1,3 +1,5 @@ name = files ver = 0.9 priority = 0 +depends = + diff --git a/rvs/plugins/files/lib/stdio.sh b/rvs/plugins/files/lib/stdio.sh index 09d2ec7..974e98e 100644 --- a/rvs/plugins/files/lib/stdio.sh +++ b/rvs/plugins/files/lib/stdio.sh @@ -1,7 +1,7 @@ #!/bin/sh -#name='rvs @ID@ stdio' +#name='stdio' #ver=0.9 -# Copyright (C) 2009 Luke Shumaker +# Copyright (C) 2009-2010 Luke Shumaker # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -41,18 +41,26 @@ fatal () { error() { warn "$1" cat << __error__ >> /dev/stderr -Usage: $name $usage +Usage: $RVS $name $usage -Try \`$name --help' for more options. +Try \`$RVS help $name' for more options. __error__ exit 1 } +getvar() { + if [ -z "$1" ]; then + error + else + echo $1 + fi +} + version() { echo "$name $ver" if [ "$volume" != '-q' ]; then cat << __disclaimer__ -$name is copyright (C) 2009 Luke Shumaker +$name is copyright (C) 2009-2010 Luke Shumaker This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/rvs/plugins/tags/bin/commit.sh b/rvs/plugins/tags/bin/commit.sh index e69de29..3d37ed5 100644 --- a/rvs/plugins/tags/bin/commit.sh +++ b/rvs/plugins/tags/bin/commit.sh @@ -0,0 +1,25 @@ +#!/bin/sh +name='rvs @ID@ commit' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +if [ "$RVS_LEVEL" = '0' ]; then + id=`cat "$TMPDIR/commit/files"` + "$RVS" tag "$id" wch +fi +cat "$TMPDIR/commit/files" + diff --git a/rvs/plugins/tags/info.mk.in b/rvs/plugins/tags/info.mk.in index 1828b51..9a6ba49 100644 --- a/rvs/plugins/tags/info.mk.in +++ b/rvs/plugins/tags/info.mk.in @@ -1,3 +1,5 @@ name = tags ver = 0.1 -priority = 2 +priority = 3 +depends = >files + diff --git a/rvs/plugins/tree/bin/addparent.d.sh b/rvs/plugins/tree/bin/addparent.d.sh new file mode 100644 index 0000000..ed21085 --- /dev/null +++ b/rvs/plugins/tree/bin/addparent.d.sh @@ -0,0 +1,44 @@ +#!/bin/sh +name='addparent.d' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="usage: $RVS $name CHILD PARENT" + child=${1?"$usage"} +parent=${2?"$usage"} + +tc="`mktemp`" +tp="`mktemp`" + +"$RVS" ls "$child" '%n %i' > "$tc" +"$RVS" ls "$parent" '%n %i' > "$tc" + +while read line; do + name="`echo "$line" | sed 's:\t[a-z]/[0-9a-f]$::'`" + nID="`echo "$line" | sed 's:^.*\t::'`" + oID="`sed -n 's:^${name/':'/'\:'}\t\([a-z]/[0-9a-f]\)$:\1:p'`" + + if [ -n "$oID" ] { + nT="`"$RVS" blob-gettype "$nID"`" + oT="`"$RVS" blob-gettype "$oID"`" + if [ "$nT" = "$oT" ]; then + "$RVS" addparent "$nID" "$oID" + fi + } +done < "$tc" + +"$RVS" addparent.f "$child" "$parent" diff --git a/rvs/plugins/tree/bin/addparent.f.sh b/rvs/plugins/tree/bin/addparent.f.sh new file mode 100644 index 0000000..61b4f92 --- /dev/null +++ b/rvs/plugins/tree/bin/addparent.f.sh @@ -0,0 +1,27 @@ +#!/bin/sh +name='addparent.f' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="usage: $RVS $name CHILD PARENT" + child=${1?"$usage"} +parent=${2?"$usage"} + +file="$REPO/tree/$child/$parent" +mkdir -p "`dirname "$file"`" +echo "$parent" > "$file" + diff --git a/rvs/plugins/tree/bin/addparent.sh b/rvs/plugins/tree/bin/addparent.sh new file mode 100644 index 0000000..af60e5a --- /dev/null +++ b/rvs/plugins/tree/bin/addparent.sh @@ -0,0 +1,32 @@ +#!/bin/sh +name='addparent' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="usage: $RVS $name CHILD PARENT" + child=${1?"$usage"} +parent=${2?"$usage"} + +ct="`"$RVS" blob-gettype "$child"`" +pt="`"$RVS" blob-gettype "$parent"`" + +if [ "$ct" = "$pt" ]; then + "$RVS" "addparent.$ct" "$child" "$parent" +else + error "CHILD and PARENT must be type of the same type" +fi + diff --git a/rvs/plugins/tree/bin/delparent.f.sh b/rvs/plugins/tree/bin/delparent.f.sh new file mode 100644 index 0000000..e53df9b --- /dev/null +++ b/rvs/plugins/tree/bin/delparent.f.sh @@ -0,0 +1,34 @@ +#!/bin/sh +name='delparent.f' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="usage: $RVS $name CHILD PARENT" + child=${1?"$usage"} +parent=${2?"$usage"} + +file="$REPO/tree/$child/$parent" +rm "$file" +if [ -z "$(ls "`dirname "$file"`")" ]; then + rmdir "`dirname "$file"`" +fi + + dir="$REPO/tree/$child" +if [ -z "$(ls "`dirname "$dir"`")" ]; then + rmdir "`dirname "$dir"`" +fi + diff --git a/rvs/plugins/tree/info.mk.in b/rvs/plugins/tree/info.mk.in new file mode 100644 index 0000000..be9bc3b --- /dev/null +++ b/rvs/plugins/tree/info.mk.in @@ -0,0 +1,5 @@ +name = tree +ver = 0.1 +priority = 1 +depends = >files