[ostree] core: Remove old commit API
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] core: Remove old commit API
- Date: Wed, 9 Nov 2011 00:25:54 +0000 (UTC)
commit ed57f1c676408dea342beb7635fc9ed3fa57f661
Author: Colin Walters <walters verbum org>
Date: Tue Nov 8 19:25:23 2011 -0500
core: Remove old commit API
This eliminates more now-dead code.
libostree/ostree-repo.c | 214 -----------------------------------------------
libostree/ostree-repo.h | 12 ---
2 files changed, 0 insertions(+), 226 deletions(-)
---
diff --git a/libostree/ostree-repo.c b/libostree/ostree-repo.c
index 9e07111..d630e4c 100644
--- a/libostree/ostree-repo.c
+++ b/libostree/ostree-repo.c
@@ -1297,117 +1297,6 @@ check_path (const char *filename,
}
static gboolean
-walk_parsed_tree (OstreeRepo *self,
- const char *filename,
- ParsedTreeData *tree,
- int *out_filename_index, /* out*/
- char **out_component, /* out, must free */
- ParsedTreeData **out_tree, /* out, but do not free */
- GError **error)
-{
- gboolean ret = FALSE;
- GPtrArray *components = NULL;
- ParsedTreeData *current_tree = tree;
- const char *component = NULL;
- const char *file_sha1 = NULL;
- ParsedDirectoryData *dir = NULL;
- int i;
- int ret_filename_index = 0;
-
- components = ot_util_path_split (filename);
- g_assert (components != NULL);
-
- current_tree = tree;
- for (i = 0; i < components->len - 1; i++)
- {
- component = components->pdata[i];
- file_sha1 = g_hash_table_lookup (current_tree->files, component);
- dir = g_hash_table_lookup (current_tree->directories, component);
-
- if (!(file_sha1 || dir))
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "No such file or directory: %s",
- filename);
- goto out;
- }
- else if (file_sha1)
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Encountered non-directory '%s' in '%s'",
- (char*)component,
- filename);
- goto out;
- }
- else
- {
- g_assert (dir != NULL);
- current_tree = dir->tree_data;
- ret_filename_index++;
- }
- }
-
- ret = TRUE;
- *out_filename_index = i;
- *out_component = components->pdata[components->len-1];
- components->pdata[components->len-1] = NULL; /* steal */
- *out_tree = current_tree;
- out:
- g_ptr_array_free (components, TRUE);
- return ret;
-}
-
-static gboolean
-remove_files_from_tree (OstreeRepo *self,
- const char *base,
- GPtrArray *removed_files,
- ParsedTreeData *tree,
- GError **error)
-{
- gboolean ret = FALSE;
- int i;
-
- for (i = 0; i < removed_files->len; i++)
- {
- const char *filename = removed_files->pdata[i];
- int filename_index;
- char *component = NULL;
- ParsedTreeData *parent;
- const char *file_sha1;
- ParsedTreeData *dir;
-
- if (!check_path (filename, error))
- goto out;
-
- if (!walk_parsed_tree (self, filename, tree,
- &filename_index, (char**)&component, &parent,
- error))
- goto out;
-
- file_sha1 = g_hash_table_lookup (parent->files, component);
- dir = g_hash_table_lookup (parent->directories, component);
-
- if (file_sha1)
- g_hash_table_remove (parent->files, component);
- else if (dir)
- g_hash_table_remove (parent->directories, component);
- else
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "No such file or directory: %s",
- filename);
- g_free (component);
- goto out;
- }
- g_free (component);
- }
-
- ret = TRUE;
- out:
- return ret;
-}
-
-static gboolean
add_one_directory_to_tree_and_import (OstreeRepo *self,
const char *basename,
const char *abspath,
@@ -1583,29 +1472,6 @@ add_one_path_to_tree_and_import (OstreeRepo *self,
return ret;
}
-static gboolean
-add_files_to_tree_and_import (OstreeRepo *self,
- const char *base,
- GPtrArray *added_files,
- ParsedTreeData *tree,
- GError **error)
-{
- gboolean ret = FALSE;
- int i;
-
- for (i = 0; i < added_files->len; i++)
- {
- const char *path = added_files->pdata[i];
-
- if (!add_one_path_to_tree_and_import (self, base, path, tree, error))
- goto out;
- }
-
- ret = TRUE;
- out:
- return ret;
-}
-
gboolean
ostree_repo_write_ref (OstreeRepo *self,
gboolean is_local,
@@ -1702,86 +1568,6 @@ import_root (OstreeRepo *self,
return ret;
}
-gboolean
-ostree_repo_commit (OstreeRepo *self,
- const char *branch,
- const char *parent,
- const char *subject,
- const char *body,
- GVariant *metadata,
- const char *base,
- GPtrArray *modified_files,
- GPtrArray *removed_files,
- GChecksum **out_commit,
- GError **error)
-{
- OstreeRepoPrivate *priv = GET_PRIVATE (self);
- gboolean ret = FALSE;
- ParsedDirectoryData *root = NULL;
- GVariant *previous_commit = NULL;
- GChecksum *ret_commit_checksum = NULL;
- GVariant *root_metadata = NULL;
- GChecksum *root_meta_checksum = NULL;
- char *current_head = NULL;
-
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- g_return_val_if_fail (priv->inited, FALSE);
- g_return_val_if_fail (branch != NULL, FALSE);
- g_return_val_if_fail (subject != NULL, FALSE);
- g_return_val_if_fail (metadata == NULL || g_variant_is_of_type (metadata, G_VARIANT_TYPE ("a{sv}")), FALSE);
-
- if (parent == NULL)
- parent = branch;
-
- if (!resolve_rev (self, parent, TRUE, ¤t_head, error))
- goto out;
-
- if (current_head)
- {
- if (!load_commit_and_trees (self, current_head, &previous_commit, &root, error))
- goto out;
- if (!import_directory_meta (self, base, &root_metadata, &root_meta_checksum, error))
- goto out;
- g_variant_unref (root->meta_data);
- root->meta_data = root_metadata;
- root_metadata = NULL;
- root->metadata_sha256 = g_strdup (g_checksum_get_string (root_meta_checksum));
- }
- else
- {
- /* Initial commit */
- if (!import_root (self, base, &root, error))
- goto out;
- }
-
- if (!remove_files_from_tree (self, base, removed_files, root->tree_data, error))
- goto out;
-
- if (!add_files_to_tree_and_import (self, base, modified_files, root->tree_data, error))
- goto out;
-
- if (!commit_parsed_tree (self, branch, current_head,
- subject, body, metadata, root,
- &ret_commit_checksum, error))
- goto out;
-
- ret = TRUE;
- *out_commit = ret_commit_checksum;
- ret_commit_checksum = NULL;
- out:
- if (ret_commit_checksum)
- g_checksum_free (ret_commit_checksum);
- g_free (current_head);
- if (previous_commit)
- g_variant_unref (previous_commit);
- parsed_directory_data_free (root);
- if (root_metadata)
- g_variant_unref (root_metadata);
- if (root_meta_checksum)
- g_checksum_free (root_meta_checksum);
- return ret;
-}
-
gboolean
ostree_repo_commit_from_filelist_fd (OstreeRepo *self,
const char *branch,
diff --git a/libostree/ostree-repo.h b/libostree/ostree-repo.h
index b7a259c..ef66fef 100644
--- a/libostree/ostree-repo.h
+++ b/libostree/ostree-repo.h
@@ -103,18 +103,6 @@ gboolean ostree_repo_load_variant_checked (OstreeRepo *self,
GVariant **out_variant,
GError **error);
-gboolean ostree_repo_commit (OstreeRepo *self,
- const char *branch,
- const char *parent,
- const char *subject,
- const char *body,
- GVariant *metadata,
- const char *base,
- GPtrArray *modified_files,
- GPtrArray *removed_files,
- GChecksum **out_commit,
- GError **error);
-
gboolean ostree_repo_commit_from_filelist_fd (OstreeRepo *self,
const char *branch,
const char *parent,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]