You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/11/30 21:38:03 UTC
svn commit: r1717325 - in /subversion/branches/ra-git/subversion:
include/svn_fs.h libsvn_fs_git/fs_git.h libsvn_fs_git/git-fs.c
libsvn_fs_git/git-lib.c libsvn_fs_git/git-revroot.c
Author: rhuijben
Date: Mon Nov 30 20:38:03 2015
New Revision: 1717325
URL: http://svn.apache.org/viewvc?rev=1717325&view=rev
Log:
On the ra-git branch: Implement a few more vtable functions to allow
'svnadmin info' to run on a git filesystem without returning errors.
* subversion/include/svn_fs.h
(svn_fs_git_info_t): New struct.
* subversion/libsvn_fs_git/fs_git.h
(svn_fs_git__revision_root): New function.
* subversion/libsvn_fs_git/git-fs.c
(fs_git_revision_root): Remove function here. Now in git-revroot.c.
* subversion/libsvn_fs_git/git-lib.c
(fs_git_info_fsap_dup): New function.
(library_vtable): Update registration.
* subversion/libsvn_fs_git/git-revroot.c
New file.
Added:
subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c (with props)
Modified:
subversion/branches/ra-git/subversion/include/svn_fs.h
subversion/branches/ra-git/subversion/libsvn_fs_git/fs_git.h
subversion/branches/ra-git/subversion/libsvn_fs_git/git-fs.c
subversion/branches/ra-git/subversion/libsvn_fs_git/git-lib.c
Modified: subversion/branches/ra-git/subversion/include/svn_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/include/svn_fs.h?rev=1717325&r1=1717324&r2=1717325&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/include/svn_fs.h (original)
+++ subversion/branches/ra-git/subversion/include/svn_fs.h Mon Nov 30 20:38:03 2015
@@ -3282,6 +3282,24 @@ typedef struct svn_fs_fsx_info_t {
} svn_fs_fsx_info_t;
+/**
+ * A structure that provides some information about a filesystem.
+ * Returned by svn_fs_info() for #SVN_FS_TYPE_GIT filesystems.
+ *
+ * @note Fields may be added to the end of this structure in future
+ * versions. Therefore, users shouldn't allocate structures of this
+ * type, to preserve binary compatibility.
+ *
+ * @since New in 1.10.
+ */
+typedef struct svn_fs_git_info_t {
+
+ /** Filesystem backend (#fs_type), i.e., the string #SVN_FS_TYPE_FSX. */
+ const char *fs_type;
+
+} svn_fs_git_info_t;
+
+
/** @see svn_fs_info
* @since New in 1.9. */
typedef struct svn_fs_info_placeholder_t {
Modified: subversion/branches/ra-git/subversion/libsvn_fs_git/fs_git.h
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/libsvn_fs_git/fs_git.h?rev=1717325&r1=1717324&r2=1717325&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/libsvn_fs_git/fs_git.h (original)
+++ subversion/branches/ra-git/subversion/libsvn_fs_git/fs_git.h Mon Nov 30 20:38:03 2015
@@ -89,6 +89,14 @@ svn_fs_git__db_ensure_commit(svn_fs_t *f
svn_revnum_t *latest_rev,
git_reference *ref);
+/* */
+svn_error_t *
+svn_fs_git__revision_root(svn_fs_root_t **root_p,
+ svn_fs_t *fs,
+ svn_revnum_t rev,
+ apr_pool_t *pool);
+
+
/* From revmap.c */
/* Until there is a formal api, this will synchronize the revisions */
svn_error_t *
Modified: subversion/branches/ra-git/subversion/libsvn_fs_git/git-fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/libsvn_fs_git/git-fs.c?rev=1717325&r1=1717324&r2=1717325&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/libsvn_fs_git/git-fs.c (original)
+++ subversion/branches/ra-git/subversion/libsvn_fs_git/git-fs.c Mon Nov 30 20:38:03 2015
@@ -78,12 +78,6 @@ fs_git_set_uuid(svn_fs_t *fs, const char
}
static svn_error_t *
-fs_git_revision_root(svn_fs_root_t **root_p, svn_fs_t *fs, svn_revnum_t rev, apr_pool_t *pool)
-{
- return svn_error_create(APR_ENOTIMPL, NULL, NULL);
-}
-
-static svn_error_t *
fs_git_begin_txn(svn_fs_txn_t **txn_p, svn_fs_t *fs, svn_revnum_t rev, apr_uint32_t flags, apr_pool_t *pool)
{
return svn_error_create(APR_ENOTIMPL, NULL, NULL);
@@ -146,7 +140,10 @@ fs_git_get_locks(svn_fs_t *fs, const cha
static svn_error_t *
fs_git_info_format(int *fs_format, svn_version_t **supports_version, svn_fs_t *fs, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
{
+ svn_fs_git_fs_t *fgf = fs->fsap_data;
*fs_format = 0;
+
+ SVN_ERR(svn_sqlite__read_schema_version(fs_format, fgf->sdb, scratch_pool));
*supports_version = apr_palloc(result_pool, sizeof(svn_version_t));
(*supports_version)->major = SVN_VER_MAJOR;
@@ -160,13 +157,20 @@ fs_git_info_format(int *fs_format, svn_v
static svn_error_t *
fs_git_info_config_files(apr_array_header_t **files, svn_fs_t *fs, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
{
- return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+ *files = apr_array_make(result_pool, 0, sizeof(const char*));
+
+ return SVN_NO_ERROR;
}
static svn_error_t *
fs_git_info_fsap(const void **fsap_info, svn_fs_t *fs, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
{
- return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+ svn_fs_git_info_t *fs_info = apr_pcalloc(result_pool, sizeof(*fs_info));
+ fs_info->fs_type = SVN_FS_TYPE_GIT;
+
+ *fsap_info = fs_info;
+
+ return SVN_NO_ERROR;
}
static svn_error_t *
@@ -195,7 +199,7 @@ static fs_vtable_t fs_vtable =
fs_git_revision_proplist,
fs_git_change_rev_prop,
fs_git_set_uuid,
- fs_git_revision_root,
+ svn_fs_git__revision_root,
fs_git_begin_txn,
fs_git_open_txn,
fs_git_purge_txn,
Modified: subversion/branches/ra-git/subversion/libsvn_fs_git/git-lib.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/libsvn_fs_git/git-lib.c?rev=1717325&r1=1717324&r2=1717325&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/libsvn_fs_git/git-lib.c (original)
+++ subversion/branches/ra-git/subversion/libsvn_fs_git/git-lib.c Mon Nov 30 20:38:03 2015
@@ -229,6 +229,18 @@ fs_git_set_svn_fs_open(svn_fs_t *fs,
return SVN_NO_ERROR;
}
+static void *
+fs_git_info_fsap_dup(const void *fsap_info,
+ apr_pool_t *result_pool)
+{
+ const svn_fs_git_info_t *fs_info = fsap_info;
+ svn_fs_git_info_t *dup_info;
+
+ dup_info = apr_pmemdup(result_pool, fs_info, sizeof(*fs_info));
+
+ return dup_info;
+}
+
static fs_library_vtable_t library_vtable =
{
fs_git_get_version,
@@ -245,7 +257,7 @@ static fs_library_vtable_t library_vtabl
fs_git_logfiles,
NULL /* parse_id */,
fs_git_set_svn_fs_open,
- NULL /* info_fsap_dup */
+ fs_git_info_fsap_dup
};
static volatile svn_atomic_t libgit2_init_state = 0;
Added: subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c?rev=1717325&view=auto
==============================================================================
--- subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c (added)
+++ subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c Mon Nov 30 20:38:03 2015
@@ -0,0 +1,377 @@
+/* git-revroot.c --- a git commit mapped as a revision root
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <apr_general.h>
+#include <apr_pools.h>
+
+#include "svn_fs.h"
+#include "svn_version.h"
+#include "svn_pools.h"
+
+#include "svn_private_config.h"
+
+#include "private/svn_fs_util.h"
+
+#include "../libsvn_fs/fs-loader.h"
+#include "fs_git.h"
+
+ /* Determining what has changed in a root */
+static svn_error_t *
+fs_git_paths_changed(apr_hash_t **changed_paths_p,
+ svn_fs_root_t *root,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+/* Generic node operations */
+static svn_error_t *
+fs_git_check_path(svn_node_kind_t *kind_p, svn_fs_root_t *root,
+ const char *path, apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_node_history(svn_fs_history_t **history_p,
+ svn_fs_root_t *root, const char *path,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_node_id(const svn_fs_id_t **id_p, svn_fs_root_t *root,
+ const char *path, apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_node_relation(svn_fs_node_relation_t *relation,
+ svn_fs_root_t *root_a, const char *path_a,
+ svn_fs_root_t *root_b, const char *path_b,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_node_created_rev(svn_revnum_t *revision,
+ svn_fs_root_t *root, const char *path,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_node_origin_rev(svn_revnum_t *revision,
+ svn_fs_root_t *root, const char *path,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_node_created_path(const char **created_path,
+ svn_fs_root_t *root, const char *path,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_delete_node(svn_fs_root_t *root, const char *path,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_copy(svn_fs_root_t *from_root, const char *from_path,
+ svn_fs_root_t *to_root, const char *to_path,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_revision_link(svn_fs_root_t *from_root,
+ svn_fs_root_t *to_root,
+ const char *path,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_copied_from(svn_revnum_t *rev_p, const char **path_p,
+ svn_fs_root_t *root, const char *path,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_closest_copy(svn_fs_root_t **root_p, const char **path_p,
+ svn_fs_root_t *root, const char *path,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+/* Property operations */
+static svn_error_t *
+fs_git_node_prop(svn_string_t **value_p, svn_fs_root_t *root,
+ const char *path, const char *propname,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+static svn_error_t *
+fs_git_node_proplist(apr_hash_t **table_p, svn_fs_root_t *root,
+ const char *path, apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+static svn_error_t *
+fs_git_node_has_props(svn_boolean_t *has_props, svn_fs_root_t *root,
+ const char *path, apr_pool_t *scratch_pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_change_node_prop(svn_fs_root_t *root, const char *path,
+ const char *name,
+ const svn_string_t *value,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_props_changed(int *changed_p, svn_fs_root_t *root1,
+ const char *path1, svn_fs_root_t *root2,
+ const char *path2, svn_boolean_t strict,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+/* Directories */
+static svn_error_t *
+fs_git_dir_entries(apr_hash_t **entries_p, svn_fs_root_t *root,
+ const char *path, apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_dir_optimal_order(apr_array_header_t **ordered_p,
+ svn_fs_root_t *root,
+ apr_hash_t *entries,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_make_dir(svn_fs_root_t *root, const char *path,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+/* Files */
+static svn_error_t *
+fs_git_file_length(svn_filesize_t *length_p, svn_fs_root_t *root,
+ const char *path, apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_file_checksum(svn_checksum_t **checksum,
+ svn_checksum_kind_t kind, svn_fs_root_t *root,
+ const char *path, apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_file_contents(svn_stream_t **contents,
+ svn_fs_root_t *root, const char *path,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_try_process_file_contents(svn_boolean_t *success,
+ svn_fs_root_t *target_root,
+ const char *target_path,
+ svn_fs_process_contents_func_t processor,
+ void* baton,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_make_file(svn_fs_root_t *root, const char *path,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_apply_textdelta(svn_txdelta_window_handler_t *contents_p,
+ void **contents_baton_p,
+ svn_fs_root_t *root, const char *path,
+ svn_checksum_t *base_checksum,
+ svn_checksum_t *result_checksum,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_apply_text(svn_stream_t **contents_p, svn_fs_root_t *root,
+ const char *path, svn_checksum_t *result_checksum,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_contents_changed(int *changed_p, svn_fs_root_t *root1,
+ const char *path1, svn_fs_root_t *root2,
+ const char *path2, svn_boolean_t strict,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+static svn_error_t *
+fs_git_get_file_delta_stream(svn_txdelta_stream_t **stream_p,
+ svn_fs_root_t *source_root,
+ const char *source_path,
+ svn_fs_root_t *target_root,
+ const char *target_path,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+
+/* Merging. */
+static svn_error_t *
+fs_git_merge(const char **conflict_p,
+ svn_fs_root_t *source_root,
+ const char *source_path,
+ svn_fs_root_t *target_root,
+ const char *target_path,
+ svn_fs_root_t *ancestor_root,
+ const char *ancestor_path,
+ apr_pool_t *pool)
+{
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+}
+/* Mergeinfo. */
+static svn_error_t *
+fs_git_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
+ svn_fs_root_t *root,
+ const apr_array_header_t *paths,
+ svn_mergeinfo_inheritance_t inherit,
+ svn_boolean_t include_descendants,
+ svn_boolean_t adjust_inherited_mergeinfo,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL, NULL);
+}
+
+static root_vtable_t root_vtable =
+{
+ fs_git_paths_changed,
+ fs_git_check_path,
+ fs_git_node_history,
+ fs_git_node_id,
+ fs_git_node_relation,
+ fs_git_node_created_rev,
+ fs_git_node_origin_rev,
+ fs_git_node_created_path,
+ fs_git_delete_node,
+ fs_git_copy,
+ fs_git_revision_link,
+ fs_git_copied_from,
+ fs_git_closest_copy,
+ fs_git_node_prop,
+ fs_git_node_proplist,
+ fs_git_node_has_props,
+ fs_git_change_node_prop,
+ fs_git_props_changed,
+ fs_git_dir_entries,
+ fs_git_dir_optimal_order,
+ fs_git_make_dir,
+ fs_git_file_length,
+ fs_git_file_checksum,
+ fs_git_file_contents,
+ fs_git_try_process_file_contents,
+ fs_git_make_file,
+ fs_git_apply_textdelta,
+ fs_git_apply_text,
+ fs_git_contents_changed,
+ fs_git_get_file_delta_stream,
+ fs_git_merge,
+ fs_git_get_mergeinfo
+};
+
+svn_error_t *
+svn_fs_git__revision_root(svn_fs_root_t **root_p, svn_fs_t *fs, svn_revnum_t rev, apr_pool_t *pool)
+{
+ svn_fs_root_t *root;
+
+ SVN_ERR(svn_fs__check_fs(fs, TRUE));
+
+ root = apr_pcalloc(pool, sizeof(*root));
+
+ root->pool = pool;
+ root->fs = fs;
+ root->is_txn_root = FALSE;
+ root->txn = NULL;
+ root->txn_flags = 0;
+ root->rev = 0;
+
+ root->vtable = &root_vtable;
+ root->fsap_data = NULL;
+
+ *root_p = root;
+
+ return SVN_NO_ERROR;
+}
+
Propchange: subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c
------------------------------------------------------------------------------
svn:eol-style = native