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 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'rvs/plugins/tree/bin/addparent.d.sh') 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" -- cgit v1.2.3