summaryrefslogtreecommitdiff
path: root/plugins/files
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/files')
-rw-r--r--plugins/files/bin/blob-gethash.sh26
-rw-r--r--plugins/files/bin/blob-gettype.sh26
-rw-r--r--plugins/files/bin/commit.d.sh20
-rw-r--r--plugins/files/bin/commit.f.sh11
-rw-r--r--plugins/files/bin/commit.sh6
-rw-r--r--plugins/files/bin/file-gettype.sh (renamed from plugins/files/bin/gettype.sh)6
-rw-r--r--plugins/files/bin/get.d.sh23
-rw-r--r--plugins/files/bin/get.f.sh12
-rw-r--r--plugins/files/bin/get.sh16
-rw-r--r--plugins/files/bin/ls.sh50
-rw-r--r--plugins/files/info.mk.in2
-rw-r--r--plugins/files/lib/stdio.sh18
12 files changed, 170 insertions, 46 deletions
diff --git a/plugins/files/bin/blob-gethash.sh b/plugins/files/bin/blob-gethash.sh
new file mode 100644
index 0000000..b790d28
--- /dev/null
+++ b/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/plugins/files/bin/blob-gettype.sh b/plugins/files/bin/blob-gettype.sh
new file mode 100644
index 0000000..3378506
--- /dev/null
+++ b/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/plugins/files/bin/commit.d.sh b/plugins/files/bin/commit.d.sh
index 0da1efb..d7e48f9 100644
--- a/plugins/files/bin/commit.d.sh
+++ b/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/plugins/files/bin/commit.f.sh b/plugins/files/bin/commit.f.sh
index 17de155..c27005b 100644
--- a/plugins/files/bin/commit.f.sh
+++ b/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/plugins/files/bin/commit.sh b/plugins/files/bin/commit.sh
index e8db1eb..0bb8233 100644
--- a/plugins/files/bin/commit.sh
+++ b/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/plugins/files/bin/gettype.sh b/plugins/files/bin/file-gettype.sh
index 84eb9da..2a1e0ca 100644
--- a/plugins/files/bin/gettype.sh
+++ b/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/plugins/files/bin/get.d.sh b/plugins/files/bin/get.d.sh
index 1a001d3..89bd92a 100644
--- a/plugins/files/bin/get.d.sh
+++ b/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/plugins/files/bin/get.f.sh b/plugins/files/bin/get.f.sh
index b137911..00508ab 100644
--- a/plugins/files/bin/get.f.sh
+++ b/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/plugins/files/bin/get.sh b/plugins/files/bin/get.sh
index d3f046c..639ac57 100644
--- a/plugins/files/bin/get.sh
+++ b/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/plugins/files/bin/ls.sh b/plugins/files/bin/ls.sh
new file mode 100644
index 0000000..ae225cf
--- /dev/null
+++ b/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"
+
diff --git a/plugins/files/info.mk.in b/plugins/files/info.mk.in
index 7552306..fac7862 100644
--- a/plugins/files/info.mk.in
+++ b/plugins/files/info.mk.in
@@ -1,3 +1,5 @@
name = files
ver = 0.9
priority = 0
+depends =
+
diff --git a/plugins/files/lib/stdio.sh b/plugins/files/lib/stdio.sh
index 09d2ec7..974e98e 100644
--- a/plugins/files/lib/stdio.sh
+++ b/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