summaryrefslogtreecommitdiff
path: root/rvs/plugins/files/bin
diff options
context:
space:
mode:
Diffstat (limited to 'rvs/plugins/files/bin')
-rw-r--r--rvs/plugins/files/bin/blob-gethash.sh26
-rw-r--r--rvs/plugins/files/bin/blob-gettype.sh26
-rw-r--r--rvs/plugins/files/bin/commit.d.sh20
-rw-r--r--rvs/plugins/files/bin/commit.f.sh11
-rw-r--r--rvs/plugins/files/bin/commit.sh6
-rw-r--r--rvs/plugins/files/bin/file-gettype.sh (renamed from rvs/plugins/files/bin/gettype.sh)6
-rw-r--r--rvs/plugins/files/bin/get.d.sh23
-rw-r--r--rvs/plugins/files/bin/get.f.sh12
-rw-r--r--rvs/plugins/files/bin/get.sh16
-rw-r--r--rvs/plugins/files/bin/ls.sh50
10 files changed, 155 insertions, 41 deletions
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 <http://www.gnu.org/licenses>.
+
+. "$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 <http://www.gnu.org/licenses>.
+
+. "$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 <http://www.gnu.org/licenses>.
-#. "$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/gettype.sh b/rvs/plugins/files/bin/file-gettype.sh
index 84eb9da..2a1e0ca 100644
--- a/rvs/plugins/files/bin/gettype.sh
+++ b/rvs/plugins/files/bin/file-gettype.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-name='rvs @ID@ gettype'
+name='file-gettype'
ver=0.9
# Copyright (C) 2009-2010 Luke Shumaker
#
@@ -19,8 +19,8 @@ ver=0.9
. "$LIBDIR/@ID@/stdio"
-usage="usage: $RVS gettype FILE"
-file=${1?"$usage"}
+usage="FILE"
+file="`getvar "$1"`"
if [ ! -e "$file" ]; then
fatal "file \`$file' does not exist";
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 <http://www.gnu.org/licenses>.
-#. "$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 <http://www.gnu.org/licenses>.
-#. "$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 <http://www.gnu.org/licenses>.
-#. "$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/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 <http://www.gnu.org/licenses>.
+
+. "$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"
+