summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rvs/plugins/files/bin/blob-gethash.sh2
-rw-r--r--rvs/plugins/files/bin/blob-gettype.sh2
-rw-r--r--rvs/plugins/files/bin/commit.f.sh10
-rw-r--r--rvs/plugins/files/bin/get.f.sh4
-rw-r--r--rvs/plugins/files/bin/ls.sh10
-rw-r--r--rvs/plugins/tags/bin/get-tag.sh3
-rw-r--r--rvs/plugins/tags/bin/tag-id.sh33
-rw-r--r--rvs/plugins/tree/bin/addparent.d.sh16
-rw-r--r--rvs/plugins/tree/bin/addparent.sh17
-rw-r--r--rvs/plugins/tree/bin/commit.sh28
-rw-r--r--rvs/plugins/tree/info.mk.in2
11 files changed, 96 insertions, 31 deletions
diff --git a/rvs/plugins/files/bin/blob-gethash.sh b/rvs/plugins/files/bin/blob-gethash.sh
index b790d28..74defbc 100644
--- a/rvs/plugins/files/bin/blob-gethash.sh
+++ b/rvs/plugins/files/bin/blob-gethash.sh
@@ -22,5 +22,5 @@ ver=0.9
usage="ID"
id="`getvar "$1"`"
-echo $id | sed 's:.*/::'
+echo $id | sed 's/.*://'
diff --git a/rvs/plugins/files/bin/blob-gettype.sh b/rvs/plugins/files/bin/blob-gettype.sh
index 3378506..da3ee2a 100644
--- a/rvs/plugins/files/bin/blob-gettype.sh
+++ b/rvs/plugins/files/bin/blob-gettype.sh
@@ -22,5 +22,5 @@ ver=0.9
usage="ID"
id="`getvar "$1"`"
-echo $id | sed 's:/.*::'
+echo $id | sed 's/:.*//'
diff --git a/rvs/plugins/files/bin/commit.f.sh b/rvs/plugins/files/bin/commit.f.sh
index c27005b..e0df1b2 100644
--- a/rvs/plugins/files/bin/commit.f.sh
+++ b/rvs/plugins/files/bin/commit.f.sh
@@ -19,14 +19,14 @@ ver=0.9
. "$LIBDIR/@ID@/stdio"
-usage="FILENAME [PREFIX]"
+usage="FILENAME [TYPE]"
file="`getvar "$1"`"
prefix="${2-f}"
hash=`sha1sum $file | sed "s/ .*$//"`
-if [ ! -f "$REPO/@ID@/$prefix/$hash" ]; then
- mkdir -p "$REPO/@ID@/$prefix"
- install -m 644 -o $USER -g $USER -T "$file" "$REPO/@ID@/$prefix/$hash"
+if [ ! -f "$REPO/@ID@/$hash" ]; then
+ mkdir -p "$REPO/@ID@/"
+ install -m 644 -o $USER -g $USER -T "$file" "$REPO/@ID@/$hash"
fi
-echo "$prefix/$hash"
+echo "$prefix:$hash"
diff --git a/rvs/plugins/files/bin/get.f.sh b/rvs/plugins/files/bin/get.f.sh
index 00508ab..e3d5edc 100644
--- a/rvs/plugins/files/bin/get.f.sh
+++ b/rvs/plugins/files/bin/get.f.sh
@@ -23,5 +23,7 @@ usage="FILENAME ID"
name="`getvar "$1"`"
id="`getvar "$2"`"
-install -T "$REPO/@ID@/$id" "$name"
+hash="`"$RVS" blob-gethash "$id"`"
+
+install -T "$REPO/@ID@/$hash" "$name"
diff --git a/rvs/plugins/files/bin/ls.sh b/rvs/plugins/files/bin/ls.sh
index ae225cf..9e586eb 100644
--- a/rvs/plugins/files/bin/ls.sh
+++ b/rvs/plugins/files/bin/ls.sh
@@ -41,10 +41,10 @@ while read line; do
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"
+ -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/tags/bin/get-tag.sh b/rvs/plugins/tags/bin/get-tag.sh
index d1df852..fa7895b 100644
--- a/rvs/plugins/tags/bin/get-tag.sh
+++ b/rvs/plugins/tags/bin/get-tag.sh
@@ -21,6 +21,5 @@ usage="usage: $RVS get-tag FILENAME TAG"
name="${1?"$usage"}"
tag="${2?"$usage"}"
-file="$REPO/@ID@/$tag"
-"$RVS" get "$name" "`cat "$file"`"
+"$RVS" get "$name" "`"$RVS" tag-id "$tag"`"
diff --git a/rvs/plugins/tags/bin/tag-id.sh b/rvs/plugins/tags/bin/tag-id.sh
new file mode 100644
index 0000000..ef95f69
--- /dev/null
+++ b/rvs/plugins/tags/bin/tag-id.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+name='tag-id'
+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 <http://www.gnu.org/licenses>.
+
+usage="usage: $RVS $name TAG"
+tag="${1?"$usage"}"
+
+file="$REPO/@ID@/$tag"
+
+if [ -f "$file" ]; then
+ cat "$REPO/@ID@/$tag"
+else
+ echo "$0: cannot find tag \`$tag'" >> /dev/stderr
+ exit 1
+fi
+
+
+
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 <http://www.gnu.org/licenses>.
+
+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 <tags