svn commit: r197987 - in user/des/svnsup: . src src/apply
src/distill
Dag-Erling Smorgrav
des at FreeBSD.org
Mon Oct 12 16:47:55 UTC 2009
Author: des
Date: Mon Oct 12 16:47:55 2009
New Revision: 197987
URL: http://svn.freebsd.org/changeset/base/197987
Log:
Witness the birth of svnsup!
Added:
user/des/svnsup/ (props changed)
user/des/svnsup/Makefile.am (contents, props changed)
user/des/svnsup/autogen.des (contents, props changed)
user/des/svnsup/autogen.sh (contents, props changed)
user/des/svnsup/configure.ac (contents, props changed)
user/des/svnsup/src/ (props changed)
user/des/svnsup/src/Makefile.am (contents, props changed)
user/des/svnsup/src/apply/ (props changed)
user/des/svnsup/src/apply/Makefile.am (contents, props changed)
user/des/svnsup/src/apply/main.c (contents, props changed)
user/des/svnsup/src/distill/ (props changed)
user/des/svnsup/src/distill/Makefile.am (contents, props changed)
user/des/svnsup/src/distill/auth.c (contents, props changed)
user/des/svnsup/src/distill/distill.c (contents, props changed)
user/des/svnsup/src/distill/distill.h (contents, props changed)
user/des/svnsup/src/distill/editor.c (contents, props changed)
user/des/svnsup/src/distill/error.c (contents, props changed)
user/des/svnsup/src/distill/log.c (contents, props changed)
user/des/svnsup/src/distill/ra.c (contents, props changed)
user/des/svnsup/src/distill/txdelta.c (contents, props changed)
Added: user/des/svnsup/Makefile.am
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/des/svnsup/Makefile.am Mon Oct 12 16:47:55 2009 (r197987)
@@ -0,0 +1,3 @@
+# $Id$
+
+SUBDIRS = src
Added: user/des/svnsup/autogen.des
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/des/svnsup/autogen.des Mon Oct 12 16:47:55 2009 (r197987)
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+sh -x ./autogen.sh
+set -x
+./configure --enable-wall --enable-wextra --enable-werror "$@"
Added: user/des/svnsup/autogen.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/des/svnsup/autogen.sh Mon Oct 12 16:47:55 2009 (r197987)
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $Id$
+#
+
+set -e
+
+aclocal
+autoheader
+automake --add-missing --copy --foreign
+autoconf
Added: user/des/svnsup/configure.ac
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/des/svnsup/configure.ac Mon Oct 12 16:47:55 2009 (r197987)
@@ -0,0 +1,126 @@
+#
+# $Id$
+#
+AC_PREREQ([2.59])
+AC_INIT([svnsup], [1.0], [des at des.no])
+AC_CONFIG_SRCDIR([src/distill/distill.c])
+AM_CONFIG_HEADER([config.h])
+
+AC_LANG(C)
+AC_C_CONST
+AM_INIT_AUTOMAKE
+
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+
+PKG_PROG_PKG_CONFIG
+
+AC_ARG_ENABLE(debugging,
+ AS_HELP_STRING([--enable-debugging],
+ [enable debugging (default is NO)]),
+ [
+ CFLAGS="${CFLAGS} -O0 -g"
+ CPPFLAGS="${CPPFLAGS} -DDEBUG"
+ ]
+)
+
+AC_ARG_ENABLE(wall,
+ AS_HELP_STRING([--enable-wall],
+ [gcc only: compile with -Wall (default is NO)]),
+ AS_IF([test x"${GCC+set}" = xset], [
+ CFLAGS="${CFLAGS} -Wall"
+ ], [
+ AC_MSG_WARN([-Wall is only supported on gcc])
+ ])
+)
+
+AC_ARG_ENABLE(wextra,
+ AS_HELP_STRING([--enable-wextra],
+ [gcc only: compile with -Wextra (default is NO)]),
+ AS_IF([test x"${GCC+set}" = xset], [
+ CFLAGS="${CFLAGS} -Wextra"
+ ], [
+ AC_MSG_WARN([-Wextra is only supported on gcc])
+ ])
+)
+
+AC_ARG_ENABLE(werror,
+ AS_HELP_STRING([--enable-werror],
+ [gcc only: compile with -Werror (default is NO)]),
+ AS_IF([test x"${GCC+set}" = xset], [
+ CFLAGS="${CFLAGS} -Werror"
+ ], [
+ AC_MSG_WARN([-Werror is only supported on gcc])
+ ])
+)
+
+#
+# APR
+#
+PKG_CHECK_MODULES([APR_1], [apr-1])
+
+#
+# Subersion remote access library
+#
+saved_CPPFLAGS="${CPPFLAGS}"
+CPPFLAGS="${APR_1_CFLAGS}"
+AC_CHECK_HEADER([subversion-1/svn_ra.h], [], [
+ AC_MSG_ERROR([cannot proceed without <subversion-1/svn_ra.h>])
+])
+CPPFLAGS="${saved_CPPFLAGS}"
+saved_LIBS="${LIBS}"
+LIBS=""
+AC_CHECK_LIB([svn_ra-1], [svn_ra_version], [], [
+ AC_MSG_ERROR([cannot proceed without libsvn_ra-1])
+])
+SVN_RA_1_LIBS="${LIBS}"
+LIBS="${saved_LIBS}"
+AC_SUBST([SVN_RA_1_LIBS])
+
+#
+# Subversion delta library
+#
+saved_CPPFLAGS="${CPPFLAGS}"
+CPPFLAGS="${APR_1_CFLAGS}"
+AC_CHECK_HEADER([subversion-1/svn_delta.h], [], [
+ AC_MSG_ERROR([cannot proceed without <subversion-1/svn_delta.h>])
+])
+CPPFLAGS="${saved_CPPFLAGS}"
+saved_LIBS="${LIBS}"
+AC_CHECK_LIB([svn_delta-1], [svn_delta_version], [], [
+ AC_MSG_ERROR([cannot proceed without libsvn_delta-1])
+])
+SVN_DELTA_1_LIBS="${LIBS}"
+LIBS="${saved_LIBS}"
+AC_SUBST([SVN_DELTA_1_LIBS])
+
+#
+# Subversion client library
+#
+saved_CPPFLAGS="${CPPFLAGS}"
+CPPFLAGS="${APR_1_CFLAGS}"
+AC_CHECK_HEADER([subversion-1/svn_client.h], [], [
+ AC_MSG_ERROR([cannot proceed without <subversion-1/svn_client.h>])
+])
+CPPFLAGS="${saved_CPPFLAGS}"
+saved_LIBS="${LIBS}"
+AC_CHECK_LIB([svn_client-1], [svn_client_version], [], [
+ AC_MSG_ERROR([cannot proceed without libsvn_client-1])
+])
+SVN_CLIENT_1_LIBS="${LIBS}"
+LIBS="${saved_LIBS}"
+AC_SUBST([SVN_CLIENT_1_LIBS])
+
+#
+# Output
+#
+AC_CONFIG_FILES([
+ Makefile
+ src/Makefile
+ src/distill/Makefile
+ src/apply/Makefile
+])
+AC_OUTPUT
Added: user/des/svnsup/src/Makefile.am
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/des/svnsup/src/Makefile.am Mon Oct 12 16:47:55 2009 (r197987)
@@ -0,0 +1,3 @@
+# $Id$
+
+SUBDIRS = distill apply
Added: user/des/svnsup/src/apply/Makefile.am
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/des/svnsup/src/apply/Makefile.am Mon Oct 12 16:47:55 2009 (r197987)
@@ -0,0 +1,8 @@
+# $Id$
+
+bin_PROGRAMS = svnsup-apply
+
+svnsup_apply_SOURCES = \
+ main.c
+
+svnsup_apply_LDADD =
Added: user/des/svnsup/src/apply/main.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/des/svnsup/src/apply/main.c Mon Oct 12 16:47:55 2009 (r197987)
@@ -0,0 +1,34 @@
+/*-
+ * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+
+int
+main(void)
+{
+ return (0);
+}
Added: user/des/svnsup/src/distill/Makefile.am
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/des/svnsup/src/distill/Makefile.am Mon Oct 12 16:47:55 2009 (r197987)
@@ -0,0 +1,24 @@
+# $Id$
+
+bin_PROGRAMS = svnsup-distill
+
+noinst_HEADERS = \
+ distill.h
+
+svnsup_distill_SOURCES = \
+ auth.c \
+ distill.c \
+ editor.c \
+ error.c \
+ log.c \
+ ra.c \
+ txdelta.c
+
+svnsup_distill_CPPFLAGS = \
+ ${APR_1_CFLAGS}
+
+svnsup_distill_LDADD = \
+ ${APR_1_LDADD} \
+ ${SVN_DELTA_1_LIBS} \
+ ${SVN_CLIENT_1_LIBS} \
+ ${SVN_RA_1_LIBS}
Added: user/des/svnsup/src/distill/auth.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/des/svnsup/src/distill/auth.c Mon Oct 12 16:47:55 2009 (r197987)
@@ -0,0 +1,53 @@
+/*-
+ * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+
+#include "distill.h"
+
+svn_error_t *
+username_prompt_callback(svn_auth_cred_username_t **cred,
+ void *baton,
+ const char *realm,
+ svn_boolean_t may_save,
+ apr_pool_t *pool)
+{
+
+ (void)cred;
+ (void)baton;
+ (void)realm;
+ (void)may_save;
+ (void)pool;
+ fprintf(stderr, "%s(%s)\n", __func__, realm);
+ return (SVN_NO_ERROR);
+}
Added: user/des/svnsup/src/distill/distill.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/des/svnsup/src/distill/distill.c Mon Oct 12 16:47:55 2009 (r197987)
@@ -0,0 +1,137 @@
+/*-
+ * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "distill.h"
+
+int debug;
+int verbose;
+
+static int
+distill(const char *url, unsigned long revision)
+{
+ apr_pool_t *pool;
+ apr_status_t status;
+ svn_auth_provider_object_t *auth_provider;
+ apr_array_header_t *auth_providers;
+ svn_ra_session_t *ra_session;
+ svn_error_t *error;
+
+ /* our root pool */
+ status = apr_pool_create(&pool, NULL);
+ SVNSUP_APR_ERROR(status, "apr_pool_create()");
+
+ /* set up our authentication system */
+ /* XXX check for errors */
+ auth_providers = apr_array_make(pool, 1, sizeof auth_provider);
+ svn_client_get_username_prompt_provider(&auth_provider,
+ username_prompt_callback, NULL, 0, pool);
+ APR_ARRAY_PUSH(auth_providers, svn_auth_provider_object_t *) =
+ auth_provider;
+ svn_auth_open(&ra_callbacks.auth_baton, auth_providers, pool);
+
+ /* open a connection to the repo */
+ error = svn_ra_open3(&ra_session, url, NULL, &ra_callbacks,
+ NULL, NULL, pool);
+ SVNSUP_SVN_ERROR(error, "svn_ra_open3()");
+
+ /* get revision metadata */
+ error = svn_ra_get_log2(ra_session, NULL, revision, revision, 0,
+ TRUE, TRUE, FALSE, NULL, log_entry_receiver, NULL, pool);
+ SVNSUP_SVN_ERROR(error, "svn_ra_get_log()");
+
+ /* replay the requested revision */
+ error = svn_ra_replay(ra_session, revision, revision - 1, TRUE,
+ &delta_editor, NULL, pool);
+ SVNSUP_SVN_ERROR(error, "svn_ra_replay()");
+
+ /* clean up */
+ apr_pool_destroy(pool);
+ return (0);
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: svnsup-distill [-v] url rev\n");
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ apr_status_t status;
+ const char *url;
+ char *end, *revstr;
+ unsigned long rev;
+ int opt, ret;
+
+ while ((opt = getopt(argc, argv, "dv")) != -1)
+ switch (opt) {
+ case 'd':
+ ++debug;
+ break;
+ case 'v':
+ ++verbose;
+ break;
+ default:
+ usage();
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc != 2)
+ usage();
+
+ url = argv[0];
+ revstr = argv[1];
+ if (*revstr == 'r')
+ ++revstr;
+ rev = strtoul(revstr, &end, 10);
+ if (rev == 0 || end == revstr || *end != '\0')
+ usage();
+
+ status = apr_initialize();
+ if (status != APR_SUCCESS)
+ return (1);
+
+ ret = distill(url, rev);
+
+ apr_terminate();
+ return (ret);
+}
Added: user/des/svnsup/src/distill/distill.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/des/svnsup/src/distill/distill.h Mon Oct 12 16:47:55 2009 (r197987)
@@ -0,0 +1,104 @@
+/*-
+ * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+
+#ifndef DISTILL_H_INCLUDED
+#define DISTILL_H_INCLUDED
+
+#include <apr_errno.h>
+#include <apr_general.h>
+#include <apr_hash.h>
+#include <apr_pools.h>
+#include <apr_tables.h>
+
+#include <subversion-1/svn_auth.h>
+#include <subversion-1/svn_client.h>
+#include <subversion-1/svn_delta.h>
+#include <subversion-1/svn_error.h>
+#include <subversion-1/svn_ra.h>
+
+extern int debug;
+extern int verbose;
+
+typedef struct svnsup_where {
+ const char *file;
+ int line;
+ const char *func;
+} svnsup_where_t;
+#define SVNSUP_WHERE \
+ &((struct svnsup_where){ __FILE__, __LINE__, __func__ })
+
+/* apr errors */
+void svnsup_apr_error(svnsup_where_t *, apr_status_t, const char *, ...);
+#define SVNSUP_APR_ERROR(status, ...) \
+ do { \
+ if ((status) != APR_SUCCESS) \
+ svnsup_apr_error(SVNSUP_WHERE, \
+ (status), __VA_ARGS__); \
+ } while (0)
+
+/* svn errors */
+void svnsup_svn_error(svnsup_where_t *, svn_error_t *, const char *, ...);
+#define SVNSUP_SVN_ERROR(error, ...) \
+ do { \
+ if ((error) != SVN_NO_ERROR) \
+ svnsup_svn_error(SVNSUP_WHERE, \
+ (error), __VA_ARGS__); \
+ } while (0)
+
+/* assertions */
+void svnsup_assert(svnsup_where_t *, const char *, const char *, ...);
+#define SVNSUP_ASSERT(cond, ...) \
+ do { \
+ if (!(cond)) \
+ svnsup_assert(SVNSUP_WHERE, \
+ #cond, __VA_ARGS__); \
+ } while (0)
+
+/* debugging messages */
+#define SVNSUP_DEBUG(fmt, ...) \
+ do { \
+ if (debug) \
+ fprintf(stderr, fmt, __VA_ARGS__); \
+ } while (0)
+
+/* authentication */
+svn_error_t *username_prompt_callback(svn_auth_cred_username_t **,
+ void *, const char *, svn_boolean_t, apr_pool_t *);
+
+/* callback function for log entries */
+svn_error_t *log_entry_receiver(void *, svn_log_entry_t *, apr_pool_t *);
+
+/* callback function for file deltas */
+svn_error_t *txdelta_window_handler(svn_txdelta_window_t *, void *);
+
+/* callback lists */
+extern struct svn_ra_callbacks2_t ra_callbacks;
+extern struct svn_delta_editor_t delta_editor;
+
+#endif
Added: user/des/svnsup/src/distill/editor.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/des/svnsup/src/distill/editor.c Mon Oct 12 16:47:55 2009 (r197987)
@@ -0,0 +1,269 @@
+/*-
+ * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "distill.h"
+
+svn_error_t *
+set_target_revision(void *edit_baton,
+ svn_revnum_t target_revision,
+ apr_pool_t *pool)
+{
+
+ (void)edit_baton;
+ (void)pool;
+ SVNSUP_DEBUG("%s(r%ld)\n", __func__, (long)target_revision);
+ return (SVN_NO_ERROR);
+}
+
+svn_error_t *
+open_root(void *edit_baton,
+ svn_revnum_t base_revision,
+ apr_pool_t *dir_pool,
+ void **root_baton)
+{
+
+ (void)edit_baton;
+ (void)dir_pool;
+ SVNSUP_DEBUG("%s(%ld)\n", __func__, (long)base_revision);
+ *root_baton = (void *)__LINE__;
+ return (SVN_NO_ERROR);
+}
+
+svn_error_t *
+delete_entry(const char *path,
+ svn_revnum_t revision,
+ void *parent_baton,
+ apr_pool_t *pool)
+{
+
+ (void)parent_baton;
+ (void)pool;
+ SVNSUP_DEBUG("%s(%ld, %s)\n", __func__, (long)revision, path);
+ return (SVN_NO_ERROR);
+}
+
+svn_error_t *
+add_directory(const char *path,
+ void *parent_baton,
+ const char *copyfrom_path,
+ svn_revnum_t copyfrom_revision,
+ apr_pool_t *dir_pool,
+ void **child_baton)
+{
+
+ (void)parent_baton;
+ (void)dir_pool;
+ SVNSUP_DEBUG("%s(%s, %s, %ld)\n", __func__, path,
+ copyfrom_path, (long)copyfrom_revision);
+ *child_baton = (void *)__LINE__;
+ return (SVN_NO_ERROR);
+}
+
+svn_error_t *
+open_directory(const char *path,
+ void *parent_baton,
+ svn_revnum_t base_revision,
+ apr_pool_t *dir_pool,
+ void **child_baton)
+{
+
+ (void)parent_baton;
+ (void)dir_pool;
+ SVNSUP_DEBUG("%s(%s, %ld)\n", __func__, path,
+ (long)base_revision);
+ *child_baton = (void *)__LINE__;
+ return (SVN_NO_ERROR);
+}
+
+svn_error_t *
+change_dir_prop(void *dir_baton,
+ const char *name,
+ const svn_string_t *value,
+ apr_pool_t *pool)
+{
+
+ (void)dir_baton;
+ (void)pool;
+ SVNSUP_DEBUG("%s(%s, %s)\n", __func__, name, value->data);
+ return (SVN_NO_ERROR);
+}
+
+svn_error_t *
+close_directory(void *dir_baton,
+ apr_pool_t *pool)
+{
+
+ (void)dir_baton;
+ (void)pool;
+ SVNSUP_DEBUG("%s()\n", __func__);
+ return (SVN_NO_ERROR);
+}
+
+svn_error_t *
+absent_directory(const char *path,
+ void *parent_baton,
+ apr_pool_t *pool)
+{
+
+ (void)parent_baton;
+ (void)pool;
+ SVNSUP_DEBUG("%s(%s)\n", __func__, path);
+ return (SVN_NO_ERROR);
+}
+
+svn_error_t *
+add_file(const char *path,
+ void *parent_baton,
+ const char *copyfrom_path,
+ svn_revnum_t copyfrom_revision,
+ apr_pool_t *file_pool,
+ void **file_baton)
+{
+
+ (void)parent_baton;
+ (void)file_pool;
+ SVNSUP_DEBUG("%s(%s, %s, %ld)\n", __func__, path,
+ copyfrom_path, (long)copyfrom_revision);
+ *file_baton = (void *)__LINE__;
+ return (SVN_NO_ERROR);
+}
+
+svn_error_t *
+open_file(const char *path,
+ void *parent_baton,
+ svn_revnum_t base_revision,
+ apr_pool_t *file_pool,
+ void **file_baton)
+{
+
+ (void)parent_baton;
+ (void)file_pool;
+ SVNSUP_DEBUG("%s(%s, %ld)\n", __func__, path,
+ (long)base_revision);
+ *file_baton = (void *)__LINE__;
+ return (SVN_NO_ERROR);
+}
+
+svn_error_t *
+apply_textdelta(void *file_baton,
+ const char *base_checksum,
+ apr_pool_t *pool,
+ svn_txdelta_window_handler_t *handler,
+ void **handler_baton)
+{
+
+ (void)file_baton;
+ (void)pool;
+ SVNSUP_DEBUG("%s(%s)\n", __func__, base_checksum);
+ *handler = txdelta_window_handler;
+ *handler_baton = (void *)__LINE__;
+ return (SVN_NO_ERROR);
+}
+
+svn_error_t *
+change_file_prop(void *file_baton,
+ const char *name,
+ const svn_string_t *value,
+ apr_pool_t *pool)
+{
+
+ (void)file_baton;
+ (void)pool;
+ SVNSUP_DEBUG("%s(%s, %s)\n", __func__, name, value->data);
+ return (SVN_NO_ERROR);
+}
+
+svn_error_t *
+close_file(void *file_baton,
+ const char *text_checksum,
+ apr_pool_t *pool)
+{
+
+ (void)file_baton;
+ (void)pool;
+ SVNSUP_DEBUG("%s(%s)\n", __func__, text_checksum);
+ return (SVN_NO_ERROR);
+}
+
+svn_error_t *
+absent_file(const char *path,
+ void *parent_baton,
+ apr_pool_t *pool)
+{
+
+ (void)parent_baton;
+ (void)pool;
+ SVNSUP_DEBUG("%s(%s)\n", __func__, path);
+ return (SVN_NO_ERROR);
+}
+
+svn_error_t *
+close_edit(void *edit_baton,
+ apr_pool_t *pool)
+{
+
+ (void)edit_baton;
+ (void)pool;
+ SVNSUP_DEBUG("%s()\n", __func__);
+ return (SVN_NO_ERROR);
+}
+
+svn_error_t *
+abort_edit(void *edit_baton,
+ apr_pool_t *pool)
+{
+
+ (void)edit_baton;
+ (void)pool;
+ SVNSUP_DEBUG("%s()\n", __func__);
+ return (SVN_NO_ERROR);
+}
+
+struct svn_delta_editor_t delta_editor = {
+ .set_target_revision = set_target_revision,
+ .open_root = open_root,
+ .delete_entry = delete_entry,
+ .add_directory = add_directory,
+ .open_directory = open_directory,
+ .change_dir_prop = change_dir_prop,
+ .close_directory = close_directory,
+ .absent_directory = absent_directory,
+ .add_file = add_file,
+ .open_file = open_file,
+ .apply_textdelta = apply_textdelta,
+ .change_file_prop = change_file_prop,
+ .close_file = close_file,
+ .absent_file = absent_file,
+ .close_edit = close_edit,
+ .abort_edit = abort_edit,
+};
Added: user/des/svnsup/src/distill/error.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/des/svnsup/src/distill/error.c Mon Oct 12 16:47:55 2009 (r197987)
@@ -0,0 +1,89 @@
+/*-
+ * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "distill.h"
+
+void
+svnsup_svn_error(svnsup_where_t *where, svn_error_t *error, const char *fmt, ...)
+{
+ va_list ap;
+
+ fprintf(stderr, "svnsup: ");
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ fprintf(stderr, "\n");
+ svn_handle_error2(error, stderr, FALSE, "svnsup: ");
+ if (debug)
+ fprintf(stderr, "svnsup: in %s() on line %d of %s\n",
+ where->func, where->line, where->file);
+ exit(1);
+}
+
+void
+svnsup_apr_error(svnsup_where_t *where, apr_status_t status, const char *fmt, ...)
+{
+ char errbuf[1024];
+ va_list ap;
+
+ fprintf(stderr, "svnsup: ");
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ apr_strerror(status, errbuf, sizeof(errbuf));
+ fprintf(stderr, "\nsvnsup: %s\n", errbuf);
+ if (debug)
+ fprintf(stderr, "svnsup: in %s() on line %d of %s\n",
+ where->func, where->line, where->file);
+ exit(1);
+}
+
+void
+svnsup_assert(svnsup_where_t *where, const char *cond, const char *fmt, ...)
+{
+ va_list ap;
+
+ if (debug)
+ fprintf(stderr, "svnsup: assertion failed: %s\n", cond);
+ fprintf(stderr, "svnsup: ");
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ if (debug)
+ fprintf(stderr, "svnsup: in %s() on line %d of %s\n",
+ where->func, where->line, where->file);
+ exit(1);
+}
Added: user/des/svnsup/src/distill/log.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/des/svnsup/src/distill/log.c Mon Oct 12 16:47:55 2009 (r197987)
@@ -0,0 +1,75 @@
+/*-
+ * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+
+#include "distill.h"
+
+svn_error_t *
+log_entry_receiver(void *baton,
+ svn_log_entry_t *log_entry,
+ apr_pool_t *pool)
+{
+#if 0
+ apr_hash_index_t *hash_index;
+ const void *key;
+ void *value;
+ apr_ssize_t keylen;
+#else
+ svn_string_t *value;
+#endif
+
+ (void)pool;
+ (void)baton;
+ SVNSUP_DEBUG("%s(r%lu)\n", __func__, (long)log_entry->revision);
+ fprintf(stderr, "revision properties:\n");
+#if 0
+ for (hash_index = apr_hash_first(pool, log_entry->revprops);
+ hash_index != NULL; hash_index = apr_hash_next(hash_index)) {
+ apr_hash_this(hash_index, &key, &keylen, &value);
+ fprintf(stderr, " %s: %s\n", (const char *)key,
+ ((svn_string_t *)value)->data);
+ }
+#else
+ do {
+ const char *props[] = { "svn:author", "svn:date", NULL };
+ const char **p;
+ for (p = props; *p != NULL; ++p) {
+ value = apr_hash_get(log_entry->revprops, *p, APR_HASH_KEY_STRING);
+ SVNSUP_ASSERT(value != NULL, "revision has no %s property", *p);
+ fprintf(stderr, " %s: %s\n", *p, value->data);
+ }
+ } while (0);
+#endif
+ return (SVN_NO_ERROR);
+}
Added: user/des/svnsup/src/distill/ra.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/des/svnsup/src/distill/ra.c Mon Oct 12 16:47:55 2009 (r197987)
@@ -0,0 +1,155 @@
+/*-
+ * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-user
mailing list