[ostree] core: pull-local: Be a bit more verbose, don't open objects we already have
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] core: pull-local: Be a bit more verbose, don't open objects we already have
- Date: Sat, 5 May 2012 13:56:55 +0000 (UTC)
commit 6cdbedf4e6a999cbc920c971f574da7c6f958807
Author: Colin Walters <walters verbum org>
Date: Wed May 2 19:15:19 2012 -0400
core: pull-local: Be a bit more verbose, don't open objects we already have
src/ostree/ot-builtin-pull-local.c | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/src/ostree/ot-builtin-pull-local.c b/src/ostree/ot-builtin-pull-local.c
index 7bdd72d..5650b30 100644
--- a/src/ostree/ot-builtin-pull-local.c
+++ b/src/ostree/ot-builtin-pull-local.c
@@ -108,6 +108,7 @@ ostree_builtin_pull_local (int argc, char **argv, GFile *repo_path, GError **err
ot_lobj GFile *src_dir = NULL;
ot_lobj GFile *dest_dir = NULL;
ot_lhash GHashTable *refs_to_clone = NULL;
+ ot_lhash GHashTable *source_objects = NULL;
ot_lhash GHashTable *objects_to_copy = NULL;
OtLocalCloneData data;
@@ -164,17 +165,39 @@ ostree_builtin_pull_local (int argc, char **argv, GFile *repo_path, GError **err
}
}
- objects_to_copy = ostree_traverse_new_reachable ();
+ g_print ("Enumerating objects...\n");
+
+ source_objects = ostree_traverse_new_reachable ();
g_hash_table_iter_init (&hash_iter, refs_to_clone);
while (g_hash_table_iter_next (&hash_iter, &key, &value))
{
const char *checksum = value;
- if (!ostree_traverse_commit (data.src_repo, checksum, 0, objects_to_copy, cancellable, error))
+ if (!ostree_traverse_commit (data.src_repo, checksum, 0, source_objects, cancellable, error))
+ goto out;
+ }
+
+ objects_to_copy = ostree_traverse_new_reachable ();
+ g_hash_table_iter_init (&hash_iter, source_objects);
+ while (g_hash_table_iter_next (&hash_iter, &key, &value))
+ {
+ GVariant *serialized_key = key;
+ gboolean has_object;
+ const char *checksum;
+ OstreeObjectType objtype;
+
+ ostree_object_name_deserialize (serialized_key, &checksum, &objtype);
+
+ if (!ostree_repo_has_object (data.dest_repo, objtype, checksum, &has_object,
+ cancellable, error))
goto out;
+ if (!has_object)
+ g_hash_table_insert (objects_to_copy, g_variant_ref (serialized_key), serialized_key);
}
+ g_print ("%u objects to copy\n", g_hash_table_size (objects_to_copy));
+
if (!ostree_repo_prepare_transaction (data.dest_repo, cancellable, error))
goto out;
@@ -194,6 +217,8 @@ ostree_builtin_pull_local (int argc, char **argv, GFile *repo_path, GError **err
if (!ostree_repo_commit_transaction (data.dest_repo, NULL, error))
goto out;
+ g_print ("Writing %u refs\n", g_hash_table_size (refs_to_clone));
+
g_hash_table_iter_init (&hash_iter, refs_to_clone);
while (g_hash_table_iter_next (&hash_iter, &key, &value))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]