summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2010-04-14 18:27:44 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-06-26 00:30:20 -0600
commit662ea51a86049853c0a8e279e5b515b80d5123d8 (patch)
tree6a852f4f0ef50196d1b6659f5863872b1662357e
parent9a027edc9ab8cd71fba33b322845fce5451b9ea3 (diff)
I'm commiting these partial changes in case I ever need to come back to it.
See, I just had a brain-gasm on how I can make the module system better.
-rw-r--r--Makefile1
-rw-r--r--Makefile.in1
-rw-r--r--rvs/main.mk.in3
-rw-r--r--rvs/plugins/comments/bin/commit.sh1
-rw-r--r--rvs/plugins/comments/bin/print.sh28
-rw-r--r--rvs/plugins/comments/bin/showcomment.sh27
-rw-r--r--rvs/plugins/date.author/bin/commit.sh28
-rw-r--r--rvs/plugins/date.author/info.mk.in5
-rw-r--r--rvs/plugins/files/bin/get.d.sh2
-rw-r--r--rvs/plugins/files/bin/print.sh39
-rw-r--r--rvs/plugins/files/bin/tree.sh40
-rw-r--r--rvs/plugins/main.mk.in2
-rw-r--r--rvs/plugins/tags/bin/commit.sh1
-rw-r--r--rvs/plugins/tags/bin/print.sh30
-rw-r--r--rvs/plugins/tree/bin/commit.sh1
-rw-r--r--rvs/plugins/tree/bin/getchildren.sh28
-rw-r--r--rvs/plugins/tree/bin/getparents.sh27
-rw-r--r--rvs/plugins/tree/bin/print.sh27
-rw-r--r--rvs/wrapper/rvs.sh21
19 files changed, 295 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 8483002..f5af1b6 100644
--- a/Makefile
+++ b/Makefile
@@ -65,6 +65,7 @@ Makefiles-% : %-build complete-%
$(MAKE) -C $< Makefiles
build-% : %-build %-build/Makefile; $(MAKE) -C $<
+dist-% : %-build %-build/Makefile; $(MAKE) -C $< dist
install-% : %-build %-build/Makefile; $(MAKE) -C $< install
uninstall-% : %-build %-build/Makefile; $(MAKE) -C $< uninstall
clean-% : %-build %-build/Makefile; $(MAKE) -C $< clean
diff --git a/Makefile.in b/Makefile.in
index 8bd27a8..cfe9772 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -52,6 +52,7 @@ $(d) :
$(INSTALL) -m 777 -d $@
$(d)/% : $(srcdir)/% $(d)
+ $(INSTALL) -m 777 -d $(dir $@)
cp $< $@
# implicit rules #####################################################
diff --git a/rvs/main.mk.in b/rvs/main.mk.in
index e3a6c96..cf47a81 100644
--- a/rvs/main.mk.in
+++ b/rvs/main.mk.in
@@ -1,6 +1,6 @@
#!/usr/bin/make -f
name = @name@
-ver = 0.9
+ver = 0.9-beta1
# Copyright (C) 2009 Luke Shumaker
#
# This program is free software; you can redistribute it and/or
@@ -45,6 +45,7 @@ filelist = \
clean : clean-wrapper clean-plugins
distclean : clean distclean-wrapper distclean-plugins
$(RM) Makefile *.mk
+ $(RM) -r $(name)-$(ver)
install : install-wrapper install-plugins
uninstall :
$(MAKE) uninstall-plugins
diff --git a/rvs/plugins/comments/bin/commit.sh b/rvs/plugins/comments/bin/commit.sh
index 4ef2c5d..d13d754 100644
--- a/rvs/plugins/comments/bin/commit.sh
+++ b/rvs/plugins/comments/bin/commit.sh
@@ -21,5 +21,4 @@ if [ "$RVS_LEVEL" = '0' ]; then
id=`cat "$TMPDIR/commit/files"`
"$RVS" comment "$id"
fi
-cat "$TMPDIR/commit/files"
diff --git a/rvs/plugins/comments/bin/print.sh b/rvs/plugins/comments/bin/print.sh
new file mode 100644
index 0000000..b04a9cc
--- /dev/null
+++ b/rvs/plugins/comments/bin/print.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+name='print'
+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 ID"
+id="${1?"$usage"}"
+
+file="$REPO/@ID@/$id"
+if [ -e "$file" ]; then
+ echo "Comment:"
+ sed 's/\(.*\)/ > \1/' "$file"
+fi
+
diff --git a/rvs/plugins/comments/bin/showcomment.sh b/rvs/plugins/comments/bin/showcomment.sh
new file mode 100644
index 0000000..efbc00a
--- /dev/null
+++ b/rvs/plugins/comments/bin/showcomment.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+name='showcomment'
+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 ID"
+id="${1?"$usage"}"
+
+file="$REPO/@ID@/$id"
+if [ -e "$file" ]; then
+ cat "$file"
+fi
+
diff --git a/rvs/plugins/date.author/bin/commit.sh b/rvs/plugins/date.author/bin/commit.sh
new file mode 100644
index 0000000..c05f77b
--- /dev/null
+++ b/rvs/plugins/date.author/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"`
+ time=`date +%s`
+ file="$REPO/@ID@/$time"
+ if [ -n "$wch" ]; then
+ "$RVS" addparent "$id" "$wch"
+ fi
+fi
+
diff --git a/rvs/plugins/date.author/info.mk.in b/rvs/plugins/date.author/info.mk.in
new file mode 100644
index 0000000..66e8d1e
--- /dev/null
+++ b/rvs/plugins/date.author/info.mk.in
@@ -0,0 +1,5 @@
+name = date.author
+ver = 0.9
+priority = 4
+depends = >files author
+
diff --git a/rvs/plugins/files/bin/get.d.sh b/rvs/plugins/files/bin/get.d.sh
index 89bd92a..646e29d 100644
--- a/rvs/plugins/files/bin/get.d.sh
+++ b/rvs/plugins/files/bin/get.d.sh
@@ -38,7 +38,7 @@ while read line; do
i="`echo "$line" | cut -f4`" # ID
n="`echo "$line" | cut -f5-`" # name
"$RVS" get "$n" "$i"
- #chmod "$p" "$n"
+ chmod "$p" "$n"
#chown "$o:$g" "$n"
done < "$tmp"
diff --git a/rvs/plugins/files/bin/print.sh b/rvs/plugins/files/bin/print.sh
new file mode 100644
index 0000000..3657d2f
--- /dev/null
+++ b/rvs/plugins/files/bin/print.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+name='print'
+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='ID'
+id="`getvar "$1"`"
+
+hash="`"$RVS" blob-gethash "$id"`"
+file="$REPO/@ID@/$hash"
+
+if [ -e "$file" ]; then
+ t="`"$RVS" blob-gettype "$id"`"
+ type=''
+ case "$t" in
+ f) type='regular file';;
+ d) type='directory';;
+ esac
+ echo "File Type: $t ($type)"
+else
+ fatal "no object with ID \`$id'"
+fi
+
diff --git a/rvs/plugins/files/bin/tree.sh b/rvs/plugins/files/bin/tree.sh
new file mode 100644
index 0000000..6164d94
--- /dev/null
+++ b/rvs/plugins/files/bin/tree.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+name='tree'
+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 [NAME] [PREFIX] [LAST]"
+id="`getvar "$1"`"
+name="${2-.}"
+pref="$3"
+last="$4"
+
+echo "$pref $name $id"
+pref=' | '
+"$RVS" ls "$id" '%i\t%n' | while read line; do
+ i="`echo "$line" | cut -f1`"
+ n="`echo "$line" | cut -f2-`"
+ t="`"$RVS" blob-gettype "$i"`"
+ if [ "$t" = 'd' ]
+ "$RVS" tree "$i" "$n" "$pref"
+ else
+ echo "$pref $n $i"
+ fi
+done
+
diff --git a/rvs/plugins/main.mk.in b/rvs/plugins/main.mk.in
index 677ffe6..774e4ac 100644
--- a/rvs/plugins/main.mk.in
+++ b/rvs/plugins/main.mk.in
@@ -24,7 +24,7 @@ LIBDIR = @LIBDIR@
ETCDIR = @ETCDIR@
dirs += $(sysconfdir) $(BINDIR) $(TMPDIR) $(LIBDIR) $(ETCDIR)
-mods = $(patsubst ./%,%,$(shell find ./* -maxdepth 0 -type d))
+mods = files tags
mods-build = $(addprefix build-,$(mods))
mods-install = $(addprefix install-,$(mods))
mods-uninstall = $(addprefix uninstall-,$(mods))
diff --git a/rvs/plugins/tags/bin/commit.sh b/rvs/plugins/tags/bin/commit.sh
index 3d37ed5..9282a11 100644
--- a/rvs/plugins/tags/bin/commit.sh
+++ b/rvs/plugins/tags/bin/commit.sh
@@ -21,5 +21,4 @@ if [ "$RVS_LEVEL" = '0' ]; then
id=`cat "$TMPDIR/commit/files"`
"$RVS" tag "$id" wch
fi
-cat "$TMPDIR/commit/files"
diff --git a/rvs/plugins/tags/bin/print.sh b/rvs/plugins/tags/bin/print.sh
new file mode 100644
index 0000000..b7bc1c5
--- /dev/null
+++ b/rvs/plugins/tags/bin/print.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+name='print'
+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 ID"
+id="${1?"$usage"}"
+
+dir="$REPO/@ID@"
+if [ -d "$dir" ]; then
+ cd "$dir"
+ echo "Tags:"
+ grep -rFxl "$id" ./ | sed 's/^\.\/\(.*\)/ \1/'
+fi
+
+
diff --git a/rvs/plugins/tree/bin/commit.sh b/rvs/plugins/tree/bin/commit.sh
index f4e6042..89b1bf6 100644
--- a/rvs/plugins/tree/bin/commit.sh
+++ b/rvs/plugins/tree/bin/commit.sh
@@ -24,5 +24,4 @@ if [ "$RVS_LEVEL" = '0' ]; then
"$RVS" addparent "$id" "$wch"
fi
fi
-cat "$TMPDIR/commit/files"
diff --git a/rvs/plugins/tree/bin/getchildren.sh b/rvs/plugins/tree/bin/getchildren.sh
new file mode 100644
index 0000000..952522c
--- /dev/null
+++ b/rvs/plugins/tree/bin/getchildren.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+name='getchildren'
+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 ID"
+id="${1?"$usage"}"
+
+dir="$REPO/@ID@/"
+if [ -d "$dir" ]; then
+ grep -rFxh "$id" "$dir"
+fi
+
+
diff --git a/rvs/plugins/tree/bin/getparents.sh b/rvs/plugins/tree/bin/getparents.sh
new file mode 100644
index 0000000..6e3edbd
--- /dev/null
+++ b/rvs/plugins/tree/bin/getparents.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+name='getparents'
+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 ID"
+id="${1?"$usage"}"
+
+dir="$REPO/@ID@/$id"
+if [ -d "$dir" ]; then
+ cat "$dir"/*
+fi
+
diff --git a/rvs/plugins/tree/bin/print.sh b/rvs/plugins/tree/bin/print.sh
new file mode 100644
index 0000000..0ebf8fd
--- /dev/null
+++ b/rvs/plugins/tree/bin/print.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+name='print'
+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 ID"
+id="${1?"$usage"}"
+
+echo "Parents:"
+"$RVS" getparents "$id" | sed 's/\(.*\)/ \1/'
+echo "Children:"
+"$RVS" getchildren "$id" | sed 's/\(.*\)/ \1/'
+
diff --git a/rvs/wrapper/rvs.sh b/rvs/wrapper/rvs.sh
index c2e3594..101268f 100644
--- a/rvs/wrapper/rvs.sh
+++ b/rvs/wrapper/rvs.sh
@@ -18,11 +18,11 @@ ver='0.9'
# along with this program; see the file COPYING.
# If not, see <http://www.gnu.org/licenses>.
-export RVS="$0" #RVS="@RVS@"
- BINDIR="@BINDIR@"
- baseTMPDIR="@TMPDIR@"
-export LIBDIR="@LIBDIR@"
-export ETCDIR="@ETCDIR@"
+export RVS="$0" #RVS='@RVS@'
+ BINDIR='@BINDIR@'
+ baseTMPDIR='@TMPDIR@'
+export LIBDIR='@LIBDIR@'
+export ETCDIR='@ETCDIR@'
################################################################################
# Internal use #
@@ -75,7 +75,7 @@ _runcom() {
exit 1
else
mkdir -p "$baseTMPDIR"
- export TMPDIR=`mktemp -d --tmpdir="$baseTMPDIR"`
+ export TMPDIR="`mktemp -d --tmpdir="$baseTMPDIR"`"
if [ -z "$RVS_LEVEL" ]; then
export RVS_LEVEL=0;
@@ -88,10 +88,9 @@ _runcom() {
elif [ -d "$BINDIR/$command" ]; then
mkdir -p "$TMPDIR/$command"
for file in "$BINDIR/$command"/*; do
- id=`basename "$file" | sed 's/^[0-9]*-//'`
- "$file" $@ > "$TMPDIR/$command/$id"
+ id="`basename "$file" | sed 's/^[0-9]*-//'`"
+ "$file" $@ | tee "$TMPDIR/$command/$id"
done
- cat "$TMPDIR/$command/$id"
else
exit 2
fi
@@ -103,7 +102,7 @@ _nextpriority() {
usage="usage: $RVS nextpriority COMMAND"
command=${1?"$usage"}
for file in "$BINDIR/$command"/*; do
- echo $file | sed 's/^\([0-9]*\)-.*/\1/'
+ echo "$file" | sed 's/^\([0-9]*\)-.*/\1/'
done | sort -n | tail -n1 | xargs expr 1 +
}
@@ -116,7 +115,7 @@ _init() {
# 0 - fine
# 1 - repo already exists
# 2 - error running init commands
- REPO=`_repo 2> /dev/null`
+ REPO="`_repo 2> /dev/null`"
if [ -z "$REPO" ]; then
export REPO="`pwd`/.$name"
install -d "$REPO"