From 67952443f7a7e3a76c9755c3e0f04789ae7705d1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 2 Apr 2010 22:03:02 -0600 Subject: well, rvs trees at least sorta work now --- rvs/plugins/tree/bin/addparent.d.sh | 16 ++++++++-------- rvs/plugins/tree/bin/addparent.sh | 17 ++++++++++------- rvs/plugins/tree/bin/commit.sh | 28 ++++++++++++++++++++++++++++ rvs/plugins/tree/info.mk.in | 2 +- 4 files changed, 47 insertions(+), 16 deletions(-) create mode 100644 rvs/plugins/tree/bin/commit.sh (limited to 'rvs/plugins/tree') diff --git a/rvs/plugins/tree/bin/addparent.d.sh b/rvs/plugins/tree/bin/addparent.d.sh index ed21085..db43dd2 100644 --- a/rvs/plugins/tree/bin/addparent.d.sh +++ b/rvs/plugins/tree/bin/addparent.d.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash name='addparent.d' ver=0.1 # Copyright (C) 2010 Luke Shumaker @@ -24,21 +24,21 @@ parent=${2?"$usage"} tc="`mktemp`" tp="`mktemp`" -"$RVS" ls "$child" '%n %i' > "$tc" -"$RVS" ls "$parent" '%n %i' > "$tc" +"$RVS" ls "$child" '%i\t%n' > "$tc" +"$RVS" ls "$parent" '%i\t%n' > "$tp" 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'`" + name="`echo "$line" | cut -f2-`" + nID="`echo "$line" | cut -f1`" + oID="`sed -n "s:^\([a-z]\:[0-9a-f]*\)\t${name/:/\\:}$:\1:p" "$tp"`" - if [ -n "$oID" ] { + if [ -n "$oID" ]; then nT="`"$RVS" blob-gettype "$nID"`" oT="`"$RVS" blob-gettype "$oID"`" if [ "$nT" = "$oT" ]; then "$RVS" addparent "$nID" "$oID" fi - } + fi done < "$tc" "$RVS" addparent.f "$child" "$parent" diff --git a/rvs/plugins/tree/bin/addparent.sh b/rvs/plugins/tree/bin/addparent.sh index af60e5a..6759bcb 100644 --- a/rvs/plugins/tree/bin/addparent.sh +++ b/rvs/plugins/tree/bin/addparent.sh @@ -21,12 +21,15 @@ 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" +if [ ! "$child" = "$parent" ]; then + ct="`"$RVS" blob-gettype "$child"`" + pt="`"$RVS" blob-gettype "$parent"`" + + if [ "$ct" = "$pt" ]; then + "$RVS" "addparent.$ct" "$child" "$parent" + else + echo "$0: CHILD and PARENT must be the same type">>/dev/stderr + exit 1 + fi fi diff --git a/rvs/plugins/tree/bin/commit.sh b/rvs/plugins/tree/bin/commit.sh new file mode 100644 index 0000000..f4e6042 --- /dev/null +++ b/rvs/plugins/tree/bin/commit.sh @@ -0,0 +1,28 @@ +#!/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"` + wch="`"$RVS" tag-id wch 2>/dev/null`" + if [ -n "$wch" ]; then + "$RVS" addparent "$id" "$wch" + fi +fi +cat "$TMPDIR/commit/files" + diff --git a/rvs/plugins/tree/info.mk.in b/rvs/plugins/tree/info.mk.in index be9bc3b..095521f 100644 --- a/rvs/plugins/tree/info.mk.in +++ b/rvs/plugins/tree/info.mk.in @@ -1,5 +1,5 @@ name = tree ver = 0.1 -priority = 1 +priority = 2 depends = >files