From 15b67942e56de4e0068f0870f257e852cd8b7c00 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 27 Feb 2016 17:47:52 -0500 Subject: wip; files were sitting here --- modules/Makefile | 2 +- modules/blobs/.#get.f.sh | 1 + modules/blobs/Makefile | 1 + modules/blobs/Makefile.inc.mk | 8 + modules/blobs/Module.mk | 0 modules/blobs/_stdio.sh | 74 +++ modules/blobs/commit.d.sh | 34 ++ modules/blobs/commit.f.sh | 37 ++ modules/blobs/commit.sh | 39 ++ modules/blobs/get.d.sh | 37 ++ modules/blobs/get.f.sh | 31 + modules/blobs/get.sh | 28 + modules/blobs/ls.sh | 50 ++ modules/blobs/print.sh | 41 ++ modules/blobs/tree.sh | 40 ++ modules/comments/Module.mk | 2 +- modules/date.author/Module.mk | 2 +- 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 | 38 -- 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/git-fast-import/.#parse.sh | 1 + modules/git-fast-import/gen-parser.mk | 154 +++++ modules/git-fast-import/parse.sh | 1077 +++++++++++++++++++++++++++++++++ modules/tags/Module.mk | 3 +- modules/tree/Module.mk | 2 +- 38 files changed, 1658 insertions(+), 528 deletions(-) create mode 120000 modules/blobs/.#get.f.sh create mode 120000 modules/blobs/Makefile create mode 100644 modules/blobs/Makefile.inc.mk create mode 100644 modules/blobs/Module.mk create mode 100644 modules/blobs/_stdio.sh create mode 100644 modules/blobs/commit.d.sh create mode 100644 modules/blobs/commit.f.sh create mode 100644 modules/blobs/commit.sh create mode 100644 modules/blobs/get.d.sh create mode 100644 modules/blobs/get.f.sh create mode 100644 modules/blobs/get.sh create mode 100644 modules/blobs/ls.sh create mode 100644 modules/blobs/print.sh create mode 100644 modules/blobs/tree.sh delete mode 120000 modules/files/Makefile delete mode 100644 modules/files/Makefile.inc.mk delete mode 100644 modules/files/Module.mk delete mode 100644 modules/files/_stdio.sh delete mode 100644 modules/files/blob-gethash.sh delete mode 100644 modules/files/blob-gettype.sh delete mode 100644 modules/files/commit.d.sh delete mode 100644 modules/files/commit.f.sh delete mode 100644 modules/files/commit.sh delete mode 100644 modules/files/file-gettype.sh delete mode 100644 modules/files/get.d.sh delete mode 100644 modules/files/get.f.sh delete mode 100644 modules/files/get.sh delete mode 100644 modules/files/ls.sh delete mode 100644 modules/files/print.sh delete mode 100644 modules/files/tree.sh create mode 120000 modules/git-fast-import/.#parse.sh create mode 100644 modules/git-fast-import/gen-parser.mk create mode 100644 modules/git-fast-import/parse.sh diff --git a/modules/Makefile b/modules/Makefile index ddd3928..8235bf3 100644 --- a/modules/Makefile +++ b/modules/Makefile @@ -19,6 +19,6 @@ include $(topsrcdir)/common.top.mk dirs += $(DESTDIR)$(pkglibexecdir)/modules src_files += Makefile module.mk -subdirs = comments date.author files tags tree +subdirs = comments date.author blobs tags tree include $(topsrcdir)/common.bottom.mk diff --git a/modules/blobs/.#get.f.sh b/modules/blobs/.#get.f.sh new file mode 120000 index 0000000..c2c97da --- /dev/null +++ b/modules/blobs/.#get.f.sh @@ -0,0 +1 @@ +luke@build64-par.lan.670:1436421582 \ No newline at end of file diff --git a/modules/blobs/Makefile b/modules/blobs/Makefile new file mode 120000 index 0000000..fa7273c --- /dev/null +++ b/modules/blobs/Makefile @@ -0,0 +1 @@ +../module.mk \ No newline at end of file diff --git a/modules/blobs/Makefile.inc.mk b/modules/blobs/Makefile.inc.mk new file mode 100644 index 0000000..8fd2d6f --- /dev/null +++ b/modules/blobs/Makefile.inc.mk @@ -0,0 +1,8 @@ +src_files += commit.d.sh commit.f.sh commit.sh get.d.sh get.f.sh get.sh ls.sh print.sh tree.sh +out_files += commit.d commit.f commit 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/blobs/Module.mk b/modules/blobs/Module.mk new file mode 100644 index 0000000..e69de29 diff --git a/modules/blobs/_stdio.sh b/modules/blobs/_stdio.sh new file mode 100644 index 0000000..0da03f0 --- /dev/null +++ b/modules/blobs/_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/blobs/commit.d.sh b/modules/blobs/commit.d.sh new file mode 100644 index 0000000..620a88f --- /dev/null +++ b/modules/blobs/commit.d.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# rvs blobs/commit.d - add a directory to the repository +# Copyright (C) 2009-2010, 2015 Luke Shumaker +# +# This file is part of rvs. +# +# 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 . + +. "${0%/*}/_stdio.sh" + +usage='DIRECTORY' +[[ $# -eq 1 ]] || errusage +dir="$1" + +shopt -s dotglob +cd "$dir" +tmpfile="$(mktemp -t "${0##*/}.XXXXXXXXXX")" +for file in *; do + id="$("$RVS" commit "$file")" + stat -c $'%a\t%u (%U)\t%g (%G)\t' -- "$file" + printf $'%s\t%s\n' "$id" "$file" +done > "$tmpfile" +"$RVS" commit.f "$tmpfile" d diff --git a/modules/blobs/commit.f.sh b/modules/blobs/commit.f.sh new file mode 100644 index 0000000..8a97c2a --- /dev/null +++ b/modules/blobs/commit.f.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# rvs blobs/commit.f - add a plain file to the repository +# Copyright (C) 2009-2010, 2015 Luke Shumaker +# +# This file is part of rvs. +# +# 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 . + +. "${0%/*}/_stdio.sh" + +usage='FILENAME [TYPE]' +case $# in + 0) errusage;; + 1) infile=$1; type=f;; + 2) infile=$1; type=$2;; + *) errusage;; +esac + +hash="$(<"$file" sha1sum | cut -d ' ' -f1)" +outfile="$RVS_REPO/blobs/$hash" +if [ ! -f "$outfile" ]; then + mkdir -p -- "${outfile%/*}" + < "$infile" gzip -9 > "$outfile" +fi +printf '%s:%s\n' "$type" "$hash" + diff --git a/modules/blobs/commit.sh b/modules/blobs/commit.sh new file mode 100644 index 0000000..e23af27 --- /dev/null +++ b/modules/blobs/commit.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# rvs blobs/commit - add a file to the repository +# Copyright (C) 2009-2010, 2015 Luke Shumaker +# +# This file is part of rvs. +# +# 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 . + +. "${0%/*}/_stdio.sh" + +usage='[FILES...]' +if [[ $# -lt 1 ]]; then + set -- . +fi + +for file in "$@"; do + local type + if test -L "$file"; then + type=l + elif test -f "$file"; then + type=f + elif test -d "$file"; then + type=d + else + error 'Unsupported file type: %s' "$file" + fi + "$RVS" "commit.$type" "$file" +done diff --git a/modules/blobs/get.d.sh b/modules/blobs/get.d.sh new file mode 100644 index 0000000..989dbe8 --- /dev/null +++ b/modules/blobs/get.d.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# rvs blobs/get.d - get a directory from the repository +# Copyright (C) 2009-2010, 2015 Luke Shumaker +# +# This file is part of rvs. +# +# 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 . + +. "${0%/*}/_stdio.sh" + +usage="DIRNAME ID" +[[ $# -eq 2 ]] || errusage +name=$1 +id=$2 + +tmpfile="$(mktemp -t "${0##*/}.XXXXXXXXXX")" +"$RVS" get.f "$tmpfile" "$id" + +mkdir -p -- "$name" +cd "$name" + +IFS=$'\t' +while read -r perm user group id name; do + "$RVS" get "$name" "$id" + chmod "$perm" "$name" +done < "$tmpfile" diff --git a/modules/blobs/get.f.sh b/modules/blobs/get.f.sh new file mode 100644 index 0000000..02185a6 --- /dev/null +++ b/modules/blobs/get.f.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# rvs blobs/get.f - get a plain file from the repository +# Copyright (C) 2009-2010, 2015 Luke Shumaker +# +# This file is part of rvs. +# +# 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 . + +. "${0%/*}/_stdio.sh" + +. "$LIBDIR/@ID@/stdio" + +usage="FILENAME ID" +[[ $# -eq 2 ]] || errusage +name=$1 +id=$2 + +mkdir -p -- "${name%/*}" +< "$REPO/blobs/${id#*:}" gunzip > "$name" + diff --git a/modules/blobs/get.sh b/modules/blobs/get.sh new file mode 100644 index 0000000..4be2732 --- /dev/null +++ b/modules/blobs/get.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# rvs blobs/get - get a file from the repository +# Copyright (C) 2009-2010, 2015 Luke Shumaker +# +# This file is part of rvs. +# +# 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 . + +. "${0%/*}/_stdio.sh" + +usage="FILENAME ID" +[[ $# -eq 2 ]] || errusage +name=$1 +id=$2 + +"$RVS" "get.${id%%:*}" "$name" "$id" + diff --git a/modules/blobs/ls.sh b/modules/blobs/ls.sh new file mode 100644 index 0000000..1c4d620 --- /dev/null +++ b/modules/blobs/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/blobs/print.sh b/modules/blobs/print.sh new file mode 100644 index 0000000..0e23adc --- /dev/null +++ b/modules/blobs/print.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# rvs files/print - ??? +# Copyright (C) 2010, 2015 Luke Shumaker +# +# This file is part of rvs. +# +# 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 . + +. "${0%/*}/_stdio.sh" + +usage='ID' +[[ $# -eq 1 ]] || errusage +id=$1 + +hash="${id#*:}" +file="$REPO/blobs/$hash" + +if [ -e "$file" ]; then + t="${id%%:*}" + type='' + case "$t" in + f) type='regular file';; + d) type='directory';; + l) type='link';; + esac + printf 'File Type: %s (%s)\n' "$t" "$type" +else + fatal 'no object with ID `%s'\' "$id" +fi + diff --git a/modules/blobs/tree.sh b/modules/blobs/tree.sh new file mode 100644 index 0000000..80202ea --- /dev/null +++ b/modules/blobs/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 . + +. "${0%/*}/_stdio.sh" + +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/comments/Module.mk b/modules/comments/Module.mk index 600df63..3fa49ac 100644 --- a/modules/comments/Module.mk +++ b/modules/comments/Module.mk @@ -1 +1 @@ -commit/comments : commit/files +commit/comments : commit/blobs diff --git a/modules/date.author/Module.mk b/modules/date.author/Module.mk index 52ac0cc..30cd2e0 100644 --- a/modules/date.author/Module.mk +++ b/modules/date.author/Module.mk @@ -1 +1 @@ -commit/date.author : commit/files +commit/date.author : commit/blobs diff --git a/modules/files/Makefile b/modules/files/Makefile deleted file mode 120000 index fa7273c..0000000 --- a/modules/files/Makefile +++ /dev/null @@ -1 +0,0 @@ -../module.mk \ No newline at end of file diff --git a/modules/files/Makefile.inc.mk b/modules/files/Makefile.inc.mk deleted file mode 100644 index 99c739e..0000000 --- a/modules/files/Makefile.inc.mk +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index e69de29..0000000 diff --git a/modules/files/_stdio.sh b/modules/files/_stdio.sh deleted file mode 100644 index 0da03f0..0000000 --- a/modules/files/_stdio.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/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 deleted file mode 100644 index 74a3f59..0000000 --- a/modules/files/blob-gethash.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/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 deleted file mode 100644 index 0dd924d..0000000 --- a/modules/files/blob-gettype.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/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 deleted file mode 100644 index 67263ec..0000000 --- a/modules/files/commit.d.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/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 deleted file mode 100644 index 4effab3..0000000 --- a/modules/files/commit.f.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/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 deleted file mode 100644 index 70573a6..0000000 --- a/modules/files/commit.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash -# rvs inner.sh - The main RVS program -# Copyright (C) 2009-2010, 2015 Luke Shumaker -# -# This file is part of rvs. -# -# 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 . - -. "$(dirname "$0")/_stdio.sh" - -if [[ $# -lt 1 ]]; then - set -- . -fi - -for file in "$@"; do - local type - if test -L "$file"; then - type=l - elif test -f "$file"; then - type=f - elif test -d "$file"; then - type=d - else - error 'Unsupported file type: %s' "$file" - fi - "$RVS" "commit.$type" "$file" -done diff --git a/modules/files/file-gettype.sh b/modules/files/file-gettype.sh deleted file mode 100644 index ac1ba4e..0000000 --- a/modules/files/file-gettype.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/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 deleted file mode 100644 index 9aa493c..0000000 --- a/modules/files/get.d.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/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 deleted file mode 100644 index d5d889d..0000000 --- a/modules/files/get.f.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/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 deleted file mode 100644 index 7dd0f1d..0000000 --- a/modules/files/get.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/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 deleted file mode 100644 index 1c4d620..0000000 --- a/modules/files/ls.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/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 deleted file mode 100644 index 9a03469..0000000 --- a/modules/files/print.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/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 deleted file mode 100644 index 4092582..0000000 --- a/modules/files/tree.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/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/git-fast-import/.#parse.sh b/modules/git-fast-import/.#parse.sh new file mode 120000 index 0000000..c2c97da --- /dev/null +++ b/modules/git-fast-import/.#parse.sh @@ -0,0 +1 @@ +luke@build64-par.lan.670:1436421582 \ No newline at end of file diff --git a/modules/git-fast-import/gen-parser.mk b/modules/git-fast-import/gen-parser.mk new file mode 100644 index 0000000..7837e5c --- /dev/null +++ b/modules/git-fast-import/gen-parser.mk @@ -0,0 +1,154 @@ +# (See Documentation/git-fast-import.txt for maintained documentation.) +# Format of STDIN stream: +# +# stream ::= cmd*; +# +# cmd ::= new_blob +# | new_commit +# | new_tag +# | reset_branch +# | checkpoint +# | progress +# ; +# +# new_blob ::= 'blob' lf +# mark? +# file_content; +# file_content ::= data; +# +# new_commit ::= 'commit' sp ref_str lf +# mark? +# ('author' (sp name)? sp '<' email '>' sp when lf)? +# 'committer' (sp name)? sp '<' email '>' sp when lf +# commit_msg +# ('from' sp commit-ish lf)? +# ('merge' sp commit-ish lf)* +# (file_change | ls)* +# lf?; +# commit_msg ::= data; +# +# ls ::= 'ls' sp '"' quoted(path) '"' lf; +# +# file_change ::= file_clr +# | file_del +# | file_rnm +# | file_cpy +# | file_obm +# | file_inm; +# file_clr ::= 'deleteall' lf; +# file_del ::= 'D' sp path_str lf; +# file_rnm ::= 'R' sp path_str sp path_str lf; +# file_cpy ::= 'C' sp path_str sp path_str lf; +# file_obm ::= 'M' sp mode sp (hexsha1 | idnum) sp path_str lf; +# file_inm ::= 'M' sp mode sp 'inline' sp path_str lf +# data; +# note_obm ::= 'N' sp (hexsha1 | idnum) sp commit-ish lf; +# note_inm ::= 'N' sp 'inline' sp commit-ish lf +# data; +# +# new_tag ::= 'tag' sp tag_str lf +# 'from' sp commit-ish lf +# ('tagger' (sp name)? sp '<' email '>' sp when lf)? +# tag_msg; +# tag_msg ::= data; +# +# reset_branch ::= 'reset' sp ref_str lf +# ('from' sp commit-ish lf)? +# lf?; +# +# checkpoint ::= 'checkpoint' lf +# lf?; +# +# progress ::= 'progress' sp not_lf* lf +# lf?; +# +# # note: the first idnum in a stream should be 1 and subsequent +# # idnums should not have gaps between values as this will cause +# # the stream parser to reserve space for the gapped values. An +# # idnum can be updated in the future to a new object by issuing +# # a new mark directive with the old idnum. +# # +# mark ::= 'mark' sp idnum lf; +# data ::= (delimited_data | exact_data) +# lf?; +# +# # note: delim may be any string but must not contain lf. +# # data_line may contain any data but must not be exactly +# # delim. +# delimited_data ::= 'data' sp '<<' delim lf +# (data_line lf)* +# delim lf; +# +# # note: declen indicates the length of binary_data in bytes. +# # declen does not include the lf preceding the binary data. +# # +# exact_data ::= 'data' sp declen lf +# binary_data; +# +# # note: quoted strings are C-style quoting supporting \c for +# # common escapes of 'c' (e..g \n, \t, \\, \") or \nnn where nnn +# # is the signed byte value in octal. Note that the only +# # characters which must actually be escaped to protect the +# # stream formatting is: \, " and LF. Otherwise these values +# # are UTF8. +# # +# commit-ish ::= (ref_str | hexsha1 | sha1exp_str | idnum); +# ref_str ::= ref; +# sha1exp_str ::= sha1exp; +# tag_str ::= tag; +# path_str ::= path | '"' quoted(path) '"' ; +# mode ::= '100644' | '644' +# | '100755' | '755' +# | '120000' +# ; +# +# declen ::= # unsigned 32 bit value, ascii base10 notation; +# bigint ::= # unsigned integer value, ascii base10 notation; +# binary_data ::= # file content, not interpreted; +# +# when ::= raw_when | rfc2822_when; +# raw_when ::= ts sp tz; +# rfc2822_when ::= # Valid RFC 2822 date and time; +# +# sp ::= # ASCII space character; +# lf ::= # ASCII newline (LF) character; +# +# # note: a colon (':') must precede the numerical value assigned to +# # an idnum. This is to distinguish it from a ref or tag name as +# # GIT does not permit ':' in ref or tag strings. +# # +# idnum ::= ':' bigint; +# path ::= # GIT style file path, e.g. "a/b/c"; +# ref ::= # GIT ref name, e.g. "refs/heads/MOZ_GECKO_EXPERIMENT"; +# tag ::= # GIT tag name, e.g. "FIREFOX_1_5"; +# sha1exp ::= # Any valid GIT SHA1 expression; +# hexsha1 ::= # SHA1 in hexadecimal format; +# +# # note: name and email are UTF8 strings, however name must not +# # contain '<' or lf and email must not contain any of the +# # following: '<', '>', lf. +# # +# name ::= # valid GIT author/committer name; +# email ::= # valid GIT author/committer email; +# ts ::= # time since the epoch in seconds, ascii base10 notation; +# tz ::= # GIT style timezone; +# +# # note: comments, ls and cat requests may appear anywhere +# # in the input, except within a data command. Any form +# # of the data command always escapes the related input +# # from comment processing. +# # +# # In case it is not clear, the '#' that starts the comment +# # must be the first character on that line (an lf +# # preceded it). +# # +# +# cat_blob ::= 'cat-blob' sp (hexsha1 | idnum) lf; +cat_blob = cat-blob${sp}(${hexsha1}|${idnum})${lf} +# ls_tree ::= 'ls' sp (hexsha1 | idnum) sp path_str lf; +ls_tree = ls${sp}(${hexsha1}|${idnum})${sp}${path_str}${lf} +# +# comment ::= '#' not_lf* lf; +comment = \#$(not_lf) +# not_lf ::= # Any byte that is not ASCII newline (LF); +not_lf = [^\n] diff --git a/modules/git-fast-import/parse.sh b/modules/git-fast-import/parse.sh new file mode 100644 index 0000000..16bc5d2 --- /dev/null +++ b/modules/git-fast-import/parse.sh @@ -0,0 +1,1077 @@ +#!/bin/bash + +program_invocation_name=$0 +if type gettext &>/dev/null; then + _() { gettext -- "$@"; } +else + _() { echo "$*"; } +fi + +IFS= + +die() { + printf "$(_ "$1")" "${@:2}" + exit 2 +} + + +# Input Format +# ------------ +# With the exception of raw file data (which Git does not interpret) +# the fast-import input format is text (ASCII) based. This text based +# format simplifies development and debugging of frontend programs, +# especially when a higher level language such as Perl, Python or +# Ruby is being used. +# +# fast-import is very strict about its input. Where we say SP below we mean +# *exactly* one space. Likewise LF means one (and only one) linefeed +# and HT one (and only one) horizontal tab. +# Supplying additional whitespace characters will cause unexpected +# results, such as branch names or file names with leading or trailing +# spaces in their name, or early termination of fast-import when it encounters +# unexpected input. +# +# Stream Comments +# ~~~~~~~~~~~~~~~ +# To aid in debugging frontends fast-import ignores any line that +# begins with `#` (ASCII pound/hash) up to and including the line +# ending `LF`. A comment line may contain any sequence of bytes +# that does not contain an LF and therefore may be used to include +# any detailed debugging information that might be specific to the +# frontend and useful when inspecting a fast-import data stream. + +get_line() { + line='#' + while [[ ${line:0:1} == '#' ]]; do + read -r line || break + done +} + +# +# Date Formats +# ~~~~~~~~~~~~ +# The following date formats are supported. A frontend should select +# the format it will use for this import by passing the format name +# in the --date-format= command-line option. +# +# `raw`:: +# This is the Git native format and is `