From 504d11ded8c1e9a0757332f2a10ed7d86dd5fc70 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 1 Jul 2015 23:22:00 -0600 Subject: A whole bunch of stuff --- modules/.gitignore | 5 +++ modules/Makefile | 24 ++++++++++++ modules/comments/Makefile | 1 + modules/comments/Makefile.inc.mk | 2 + modules/comments/Module.mk | 2 + modules/comments/comment.sh | 26 +++++++++++++ modules/comments/commit.sh | 24 ++++++++++++ modules/comments/print.sh | 28 ++++++++++++++ modules/comments/showcomment.sh | 27 ++++++++++++++ modules/date.author/Makefile | 1 + modules/date.author/Makefile.inc.mk | 2 + modules/date.author/Module.mk | 2 + modules/date.author/commit.sh | 28 ++++++++++++++ modules/files/Makefile | 1 + modules/files/Makefile.inc.mk | 8 ++++ modules/files/Module.mk | 0 modules/files/_stdio.sh | 74 +++++++++++++++++++++++++++++++++++++ modules/files/blob-gethash.sh | 26 +++++++++++++ modules/files/blob-gettype.sh | 26 +++++++++++++ modules/files/commit.d.sh | 42 +++++++++++++++++++++ modules/files/commit.f.sh | 32 ++++++++++++++++ modules/files/commit.sh | 27 ++++++++++++++ modules/files/file-gettype.sh | 39 +++++++++++++++++++ modules/files/get.d.sh | 46 +++++++++++++++++++++++ modules/files/get.f.sh | 29 +++++++++++++++ modules/files/get.sh | 32 ++++++++++++++++ modules/files/ls.sh | 50 +++++++++++++++++++++++++ modules/files/print.sh | 39 +++++++++++++++++++ modules/files/tree.sh | 40 ++++++++++++++++++++ modules/module.mk | 35 ++++++++++++++++++ modules/tags/Makefile | 1 + modules/tags/Makefile.inc.mk | 2 + modules/tags/Module.mk | 2 + modules/tags/commit.sh | 24 ++++++++++++ modules/tags/get-tag.sh | 25 +++++++++++++ modules/tags/print.sh | 30 +++++++++++++++ modules/tags/tag-id.sh | 33 +++++++++++++++++ modules/tags/tag.sh | 28 ++++++++++++++ modules/tree/Makefile | 1 + modules/tree/Makefile.inc.mk | 2 + modules/tree/Module.mk | 3 ++ modules/tree/addparent.d.sh | 44 ++++++++++++++++++++++ modules/tree/addparent.f.sh | 27 ++++++++++++++ modules/tree/addparent.sh | 35 ++++++++++++++++++ modules/tree/commit.sh | 27 ++++++++++++++ modules/tree/delparent.f.sh | 34 +++++++++++++++++ modules/tree/getchildren.sh | 28 ++++++++++++++ modules/tree/getparents.sh | 27 ++++++++++++++ modules/tree/print.sh | 27 ++++++++++++++ 49 files changed, 1118 insertions(+) create mode 100644 modules/.gitignore create mode 100644 modules/Makefile create mode 120000 modules/comments/Makefile create mode 100644 modules/comments/Makefile.inc.mk create mode 100644 modules/comments/Module.mk create mode 100644 modules/comments/comment.sh create mode 100644 modules/comments/commit.sh create mode 100644 modules/comments/print.sh create mode 100644 modules/comments/showcomment.sh create mode 120000 modules/date.author/Makefile create mode 100644 modules/date.author/Makefile.inc.mk create mode 100644 modules/date.author/Module.mk create mode 100644 modules/date.author/commit.sh create mode 120000 modules/files/Makefile create mode 100644 modules/files/Makefile.inc.mk create mode 100644 modules/files/Module.mk create mode 100644 modules/files/_stdio.sh create mode 100644 modules/files/blob-gethash.sh create mode 100644 modules/files/blob-gettype.sh create mode 100644 modules/files/commit.d.sh create mode 100644 modules/files/commit.f.sh create mode 100644 modules/files/commit.sh create mode 100644 modules/files/file-gettype.sh create mode 100644 modules/files/get.d.sh create mode 100644 modules/files/get.f.sh create mode 100644 modules/files/get.sh create mode 100644 modules/files/ls.sh create mode 100644 modules/files/print.sh create mode 100644 modules/files/tree.sh create mode 100644 modules/module.mk create mode 120000 modules/tags/Makefile create mode 100644 modules/tags/Makefile.inc.mk create mode 100644 modules/tags/Module.mk create mode 100644 modules/tags/commit.sh create mode 100644 modules/tags/get-tag.sh create mode 100644 modules/tags/print.sh create mode 100644 modules/tags/tag-id.sh create mode 100644 modules/tags/tag.sh create mode 120000 modules/tree/Makefile create mode 100644 modules/tree/Makefile.inc.mk create mode 100644 modules/tree/Module.mk create mode 100644 modules/tree/addparent.d.sh create mode 100644 modules/tree/addparent.f.sh create mode 100644 modules/tree/addparent.sh create mode 100644 modules/tree/commit.sh create mode 100644 modules/tree/delparent.f.sh create mode 100644 modules/tree/getchildren.sh create mode 100644 modules/tree/getparents.sh create mode 100644 modules/tree/print.sh (limited to 'modules') diff --git a/modules/.gitignore b/modules/.gitignore new file mode 100644 index 0000000..3c197bc --- /dev/null +++ b/modules/.gitignore @@ -0,0 +1,5 @@ +*/* +!*/Makefile +!*/.gitignore +!*/*.mk +!*/*.sh diff --git a/modules/Makefile b/modules/Makefile new file mode 100644 index 0000000..9830a8e --- /dev/null +++ b/modules/Makefile @@ -0,0 +1,24 @@ +#!/usr/bin/make -f +# Copyright (C) 2015 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +include $(dir $(lastword $(MAKEFILE_LIST)))/../config.mk +include $(topsrcdir)/common.top.mk + +dirs += $(DESTDIR)$(pkglibexecdir)/modules +src_files += Makefile module.mk +subdirs = comments date.author files tags tree + +include $(topsrcdir)/common.bottom.mk diff --git a/modules/comments/Makefile b/modules/comments/Makefile new file mode 120000 index 0000000..fa7273c --- /dev/null +++ b/modules/comments/Makefile @@ -0,0 +1 @@ +../module.mk \ No newline at end of file diff --git a/modules/comments/Makefile.inc.mk b/modules/comments/Makefile.inc.mk new file mode 100644 index 0000000..6816836 --- /dev/null +++ b/modules/comments/Makefile.inc.mk @@ -0,0 +1,2 @@ +src_files += comment.sh commit.sh print.sh showcomment.sh +out_files += comment commit print showcomment diff --git a/modules/comments/Module.mk b/modules/comments/Module.mk new file mode 100644 index 0000000..a5bbb81 --- /dev/null +++ b/modules/comments/Module.mk @@ -0,0 +1,2 @@ +commit/comments :: commit/files + diff --git a/modules/comments/comment.sh b/modules/comments/comment.sh new file mode 100644 index 0000000..0be99e5 --- /dev/null +++ b/modules/comments/comment.sh @@ -0,0 +1,26 @@ +#!/bin/sh +name='comment' +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 . + +usage="usage: $RVS $name ID" +id="${1?"$usage"}" + +file="$REPO/@ID@/$id" +mkdir -p "`dirname "$file"`" +editor "$file" >> /dev/stderr + diff --git a/modules/comments/commit.sh b/modules/comments/commit.sh new file mode 100644 index 0000000..d13d754 --- /dev/null +++ b/modules/comments/commit.sh @@ -0,0 +1,24 @@ +#!/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 . + +if [ "$RVS_LEVEL" = '0' ]; then + id=`cat "$TMPDIR/commit/files"` + "$RVS" comment "$id" +fi + diff --git a/modules/comments/print.sh b/modules/comments/print.sh new file mode 100644 index 0000000..b04a9cc --- /dev/null +++ b/modules/comments/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 . + +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/modules/comments/showcomment.sh b/modules/comments/showcomment.sh new file mode 100644 index 0000000..efbc00a --- /dev/null +++ b/modules/comments/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 . + +usage="Usage: $RVS $name ID" +id="${1?"$usage"}" + +file="$REPO/@ID@/$id" +if [ -e "$file" ]; then + cat "$file" +fi + diff --git a/modules/date.author/Makefile b/modules/date.author/Makefile new file mode 120000 index 0000000..fa7273c --- /dev/null +++ b/modules/date.author/Makefile @@ -0,0 +1 @@ +../module.mk \ No newline at end of file diff --git a/modules/date.author/Makefile.inc.mk b/modules/date.author/Makefile.inc.mk new file mode 100644 index 0000000..c6b27a2 --- /dev/null +++ b/modules/date.author/Makefile.inc.mk @@ -0,0 +1,2 @@ +src_files += commit.sh +out_files += commit diff --git a/modules/date.author/Module.mk b/modules/date.author/Module.mk new file mode 100644 index 0000000..3284d55 --- /dev/null +++ b/modules/date.author/Module.mk @@ -0,0 +1,2 @@ +commit/date.author :: commit/files + diff --git a/modules/date.author/commit.sh b/modules/date.author/commit.sh new file mode 100644 index 0000000..c05f77b --- /dev/null +++ b/modules/date.author/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 . + +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/modules/files/Makefile b/modules/files/Makefile new file mode 120000 index 0000000..fa7273c --- /dev/null +++ b/modules/files/Makefile @@ -0,0 +1 @@ +../module.mk \ No newline at end of file diff --git a/modules/files/Makefile.inc.mk b/modules/files/Makefile.inc.mk new file mode 100644 index 0000000..99c739e --- /dev/null +++ b/modules/files/Makefile.inc.mk @@ -0,0 +1,8 @@ +src_files += blob-gethash.sh blob-gettype.sh commit.d.sh commit.f.sh commit.sh file-gettype.sh get.d.sh get.f.sh get.sh ls.sh print.sh tree.sh +out_files += blob-gethash blob-gettype commit.d commit.f commit file-gettype get.d get.f get ls print tree + +src_files += _stdio.sh +sys_files += $(pkglibexecdir)/modules/$(name)/_stdio.sh + +$(DESTDIR)$(pkglibexecdir)/modules/$(name)/_stdio.sh: $(srcdir)/_stdio.sh | $(DESTDIR)$(pkglibexecdir)/modules/$(name) + $(INSTALL_DATA) $< $@ diff --git a/modules/files/Module.mk b/modules/files/Module.mk new file mode 100644 index 0000000..e69de29 diff --git a/modules/files/_stdio.sh b/modules/files/_stdio.sh new file mode 100644 index 0000000..974e98e --- /dev/null +++ b/modules/files/_stdio.sh @@ -0,0 +1,74 @@ +#!/bin/sh +#name='stdio' +#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 . + +verbose() { + if [ "$volume" == '-v' ]; then + echo $@ >> /dev/stderr + fi +} + +out() { + if [ "$volume" != '-q' ]; then + echo $@ >> /dev/stderr + fi +} + +warn () { + echo "$name: $1" >> /dev/stderr +} + +fatal () { + warn "$1" + exit 1 +} + +error() { + warn "$1" + cat << __error__ >> /dev/stderr +Usage: $RVS $name $usage + +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-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 +GNU General Public License for more details. + +Originally written by Luke Shumaker . +__disclaimer__ + fi + exit 0 +} + diff --git a/modules/files/blob-gethash.sh b/modules/files/blob-gethash.sh new file mode 100644 index 0000000..74defbc --- /dev/null +++ b/modules/files/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 . + +. "$LIBDIR/@ID@/stdio" + +usage="ID" +id="`getvar "$1"`" + +echo $id | sed 's/.*://' + diff --git a/modules/files/blob-gettype.sh b/modules/files/blob-gettype.sh new file mode 100644 index 0000000..da3ee2a --- /dev/null +++ b/modules/files/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 . + +. "$LIBDIR/@ID@/stdio" + +usage="ID" +id="`getvar "$1"`" + +echo $id | sed 's/:.*//' + diff --git a/modules/files/commit.d.sh b/modules/files/commit.d.sh new file mode 100644 index 0000000..d7e48f9 --- /dev/null +++ b/modules/files/commit.d.sh @@ -0,0 +1,42 @@ +#!/bin/sh +name='commit.d' +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 . + +. "$LIBDIR/@ID@/stdio" + +usage="DIRNAME" +dir="`getvar "$1"`" + +tmp=`mktemp` +t=' '; + +cd "$dir" +for file in *; do + 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 +rm "$tmp" + diff --git a/modules/files/commit.f.sh b/modules/files/commit.f.sh new file mode 100644 index 0000000..e0df1b2 --- /dev/null +++ b/modules/files/commit.f.sh @@ -0,0 +1,32 @@ +#!/bin/sh +name='commit.f' +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 . + +. "$LIBDIR/@ID@/stdio" + +usage="FILENAME [TYPE]" +file="`getvar "$1"`" +prefix="${2-f}" + +hash=`sha1sum $file | sed "s/ .*$//"` +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" + diff --git a/modules/files/commit.sh b/modules/files/commit.sh new file mode 100644 index 0000000..0bb8233 --- /dev/null +++ b/modules/files/commit.sh @@ -0,0 +1,27 @@ +#!/bin/sh +name='commit' +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 . + +. "$LIBDIR/@ID@/stdio" + +usage="[FILE]" +file=${1-.} # take arg1 as the file, default to the current directory + +type=`"$RVS" file-gettype "$file"` +"$RVS" "commit.$type" "$file" + diff --git a/modules/files/file-gettype.sh b/modules/files/file-gettype.sh new file mode 100644 index 0000000..2a1e0ca --- /dev/null +++ b/modules/files/file-gettype.sh @@ -0,0 +1,39 @@ +#!/bin/sh +name='file-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 . + +. "$LIBDIR/@ID@/stdio" + +usage="FILE" +file="`getvar "$1"`" + +if [ ! -e "$file" ]; then + fatal "file \`$file' does not exist"; +else + type='' + for check in "$ETCDIR/@ID@/"*; do + type=`"$check" "$file"` + if [ -n "$type" ]; then break; fi + done + if [ -n "$type" ]; then + echo "$type" + else + fatal "cannot handle file type of \`$file'" + fi +fi + diff --git a/modules/files/get.d.sh b/modules/files/get.d.sh new file mode 100644 index 0000000..646e29d --- /dev/null +++ b/modules/files/get.d.sh @@ -0,0 +1,46 @@ +#!/bin/sh +name='get.d' +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 . + +. "$LIBDIR/@ID@/stdio" + +usage="DIRNAME ID" +dir="`getvar "$1"`" + id="`getvar "$2"`" + +tmp=`mktemp` +"$RVS" get.f "$tmp" "$id" + +#install -d "$dir" +mkdir -p "$dir" + +cd "$dir" +rm -rf ./* +while read line; do + 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/modules/files/get.f.sh b/modules/files/get.f.sh new file mode 100644 index 0000000..e3d5edc --- /dev/null +++ b/modules/files/get.f.sh @@ -0,0 +1,29 @@ +#!/bin/sh +name='get.f' +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 . + +. "$LIBDIR/@ID@/stdio" + +usage="FILENAME ID" +name="`getvar "$1"`" + id="`getvar "$2"`" + +hash="`"$RVS" blob-gethash "$id"`" + +install -T "$REPO/@ID@/$hash" "$name" + diff --git a/modules/files/get.sh b/modules/files/get.sh new file mode 100644 index 0000000..639ac57 --- /dev/null +++ b/modules/files/get.sh @@ -0,0 +1,32 @@ +#!/bin/sh +name='get' +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 . + +. "$LIBDIR/@ID@/stdio" + +usage="FILENAME ID" +name="`getvar "$1"`" + id="`getvar "$2"`" + +file="$REPO/@ID@/$id" + +type="`"$RVS" blob-gettype "$id"`" +#hash="`"$RVS" blob-gethash "$id"`" + +"$RVS" "get.$type" "$name" "$id" + diff --git a/modules/files/ls.sh b/modules/files/ls.sh new file mode 100644 index 0000000..9e586eb --- /dev/null +++ b/modules/files/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 . + +. "$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/modules/files/print.sh b/modules/files/print.sh new file mode 100644 index 0000000..3657d2f --- /dev/null +++ b/modules/files/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 . + +. "$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/modules/files/tree.sh b/modules/files/tree.sh new file mode 100644 index 0000000..6164d94 --- /dev/null +++ b/modules/files/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 . + +. "$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/modules/module.mk b/modules/module.mk new file mode 100644 index 0000000..c6e577d --- /dev/null +++ b/modules/module.mk @@ -0,0 +1,35 @@ +#!/usr/bin/make -f +# Copyright (C) 2009, 2015 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk +include $(topsrcdir)/common.top.mk + +name := $(lastword $(subst /, ,$(srcdir))) +include $(srcdir)/Makefile.inc.mk + +dirs += $(DESTDIR)$(pkglibexecdir)/modules/$(name) +src_files += Makefile Makefile.inc.mk Module.mk +sys_files += $(pkglibexecdir)/modules/$(name).mk +sys_files += $(addprefix $(pkglibexecdir)/modules/$(name)/,$(out_files)) + +$(DESTDIR)$(pkglibexecdir)/modules/$(name).mk: $(srcdir)/Module.mk | $(DESTDIR)$(pkglibexecdir)/modules + $(INSTALL_DATA) $< $@ +$(DESTDIR)$(pkglibexecdir)/modules/$(name)/%: $(srcdir)/% | $(DESTDIR)$(pkglibexecdir)/modules/$(name) + $(INSTALL_PROGRAM) $< $@ +$(DESTDIR)$(pkglibexecdir)/modules/$(name)/%: $(outdir)/% | $(DESTDIR)$(pkglibexecdir)/modules/$(name) + $(INSTALL_PROGRAM) $< $@ + +include $(topsrcdir)/common.bottom.mk diff --git a/modules/tags/Makefile b/modules/tags/Makefile new file mode 120000 index 0000000..fa7273c --- /dev/null +++ b/modules/tags/Makefile @@ -0,0 +1 @@ +../module.mk \ No newline at end of file diff --git a/modules/tags/Makefile.inc.mk b/modules/tags/Makefile.inc.mk new file mode 100644 index 0000000..8d687a5 --- /dev/null +++ b/modules/tags/Makefile.inc.mk @@ -0,0 +1,2 @@ +src_files += commit.sh get-tag.sh print.sh tag-id.sh tag.sh +out_files += commit get-tag print tag-id tag diff --git a/modules/tags/Module.mk b/modules/tags/Module.mk new file mode 100644 index 0000000..fd9e5f7 --- /dev/null +++ b/modules/tags/Module.mk @@ -0,0 +1,2 @@ +commit/tags :: commit/files + diff --git a/modules/tags/commit.sh b/modules/tags/commit.sh new file mode 100644 index 0000000..9282a11 --- /dev/null +++ b/modules/tags/commit.sh @@ -0,0 +1,24 @@ +#!/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 . + +if [ "$RVS_LEVEL" = '0' ]; then + id=`cat "$TMPDIR/commit/files"` + "$RVS" tag "$id" wch +fi + diff --git a/modules/tags/get-tag.sh b/modules/tags/get-tag.sh new file mode 100644 index 0000000..fa7895b --- /dev/null +++ b/modules/tags/get-tag.sh @@ -0,0 +1,25 @@ +#!/bin/sh +name='rvs @ID@ get-tag' +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 . + +usage="usage: $RVS get-tag FILENAME TAG" +name="${1?"$usage"}" + tag="${2?"$usage"}" + +"$RVS" get "$name" "`"$RVS" tag-id "$tag"`" + diff --git a/modules/tags/print.sh b/modules/tags/print.sh new file mode 100644 index 0000000..b7bc1c5 --- /dev/null +++ b/modules/tags/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 . + +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/modules/tags/tag-id.sh b/modules/tags/tag-id.sh new file mode 100644 index 0000000..ef95f69 --- /dev/null +++ b/modules/tags/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 . + +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/modules/tags/tag.sh b/modules/tags/tag.sh new file mode 100644 index 0000000..bc3f546 --- /dev/null +++ b/modules/tags/tag.sh @@ -0,0 +1,28 @@ +#!/bin/sh +name='rvs @ID@ tag' +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 . + +# tag ID TAG +usage="usage: $RVS tag ID TAG" + ID="${1?"$usage"}" +tag="${2?"$usage"}" + +file="$REPO/@ID@/$tag" +mkdir -p "`dirname "$file"`" +echo "$ID" > "$file" + diff --git a/modules/tree/Makefile b/modules/tree/Makefile new file mode 120000 index 0000000..fa7273c --- /dev/null +++ b/modules/tree/Makefile @@ -0,0 +1 @@ +../module.mk \ No newline at end of file diff --git a/modules/tree/Makefile.inc.mk b/modules/tree/Makefile.inc.mk new file mode 100644 index 0000000..82c0b58 --- /dev/null +++ b/modules/tree/Makefile.inc.mk @@ -0,0 +1,2 @@ +src_files += addparent.d.sh addparent.f.sh addparent.sh commit.sh delparent.f.sh getchildren.sh getparents.sh print.sh +out_files += addparent.d addparent.f addparent commit delparent.f getchildren getparents print diff --git a/modules/tree/Module.mk b/modules/tree/Module.mk new file mode 100644 index 0000000..2485770 --- /dev/null +++ b/modules/tree/Module.mk @@ -0,0 +1,3 @@ +commit/tags :: commit/tree +commit/tree :: commit/files + diff --git a/modules/tree/addparent.d.sh b/modules/tree/addparent.d.sh new file mode 100644 index 0000000..db43dd2 --- /dev/null +++ b/modules/tree/addparent.d.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +name='addparent.d' +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 . + +usage="usage: $RVS $name CHILD PARENT" + child=${1?"$usage"} +parent=${2?"$usage"} + +tc="`mktemp`" +tp="`mktemp`" + +"$RVS" ls "$child" '%i\t%n' > "$tc" +"$RVS" ls "$parent" '%i\t%n' > "$tp" + +while read line; do + 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" ]; 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/modules/tree/addparent.f.sh b/modules/tree/addparent.f.sh new file mode 100644 index 0000000..61b4f92 --- /dev/null +++ b/modules/tree/addparent.f.sh @@ -0,0 +1,27 @@ +#!/bin/sh +name='addparent.f' +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 . + +usage="usage: $RVS $name CHILD PARENT" + child=${1?"$usage"} +parent=${2?"$usage"} + +file="$REPO/tree/$child/$parent" +mkdir -p "`dirname "$file"`" +echo "$parent" > "$file" + diff --git a/modules/tree/addparent.sh b/modules/tree/addparent.sh new file mode 100644 index 0000000..6759bcb --- /dev/null +++ b/modules/tree/addparent.sh @@ -0,0 +1,35 @@ +#!/bin/sh +name='addparent' +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 . + +usage="usage: $RVS $name CHILD PARENT" + child=${1?"$usage"} +parent=${2?"$usage"} + +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/modules/tree/commit.sh b/modules/tree/commit.sh new file mode 100644 index 0000000..89b1bf6 --- /dev/null +++ b/modules/tree/commit.sh @@ -0,0 +1,27 @@ +#!/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 . + +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 + diff --git a/modules/tree/delparent.f.sh b/modules/tree/delparent.f.sh new file mode 100644 index 0000000..e53df9b --- /dev/null +++ b/modules/tree/delparent.f.sh @@ -0,0 +1,34 @@ +#!/bin/sh +name='delparent.f' +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 . + +usage="usage: $RVS $name CHILD PARENT" + child=${1?"$usage"} +parent=${2?"$usage"} + +file="$REPO/tree/$child/$parent" +rm "$file" +if [ -z "$(ls "`dirname "$file"`")" ]; then + rmdir "`dirname "$file"`" +fi + + dir="$REPO/tree/$child" +if [ -z "$(ls "`dirname "$dir"`")" ]; then + rmdir "`dirname "$dir"`" +fi + diff --git a/modules/tree/getchildren.sh b/modules/tree/getchildren.sh new file mode 100644 index 0000000..952522c --- /dev/null +++ b/modules/tree/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 . + +usage="Usage: $RVS $name ID" +id="${1?"$usage"}" + +dir="$REPO/@ID@/" +if [ -d "$dir" ]; then + grep -rFxh "$id" "$dir" +fi + + diff --git a/modules/tree/getparents.sh b/modules/tree/getparents.sh new file mode 100644 index 0000000..6e3edbd --- /dev/null +++ b/modules/tree/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 . + +usage="Usage: $RVS $name ID" +id="${1?"$usage"}" + +dir="$REPO/@ID@/$id" +if [ -d "$dir" ]; then + cat "$dir"/* +fi + diff --git a/modules/tree/print.sh b/modules/tree/print.sh new file mode 100644 index 0000000..0ebf8fd --- /dev/null +++ b/modules/tree/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 . + +usage="Usage: $RVS $name ID" +id="${1?"$usage"}" + +echo "Parents:" +"$RVS" getparents "$id" | sed 's/\(.*\)/ \1/' +echo "Children:" +"$RVS" getchildren "$id" | sed 's/\(.*\)/ \1/' + -- cgit v1.2.3-2-g168b