[epiphany] ephy-profile-migrator: add a "requested version" option to the migrator



commit d08cadfb28daad3cc5560d2aaf0815aaeb5bf21a
Author: Xan Lopez <xan igalia com>
Date:   Fri Aug 31 21:26:40 2012 +0200

    ephy-profile-migrator: add a "requested version" option to the migrator
    
    This will allow us to catch mismatches between browser and migrator binary.

 lib/ephy-profile-migrator.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/lib/ephy-profile-migrator.c b/lib/ephy-profile-migrator.c
index 5116983..0f4d499 100644
--- a/lib/ephy-profile-migrator.c
+++ b/lib/ephy-profile-migrator.c
@@ -52,6 +52,7 @@
 #include <sys/types.h>
 
 static int do_step_n = -1;
+static int version = -1;
 
 /*
  * What to do to add new migration steps:
@@ -886,6 +887,8 @@ static const GOptionEntry option_entries[] =
 {
   { "do-step", 'd', 0, G_OPTION_ARG_INT, &do_step_n,
     N_("Executes only the n-th migration step"), NULL },
+  { "version", 'v', 0, G_OPTION_ARG_INT, &version,
+    N_("Specifies the required version for the migrator"), NULL },
   { NULL }
 };
 
@@ -919,6 +922,12 @@ main (int argc, char *argv[])
         
   g_option_context_free (option_context);
 
+  if (version != -1 && version != EPHY_PROFILE_MIGRATION_VERSION) {
+    g_print ("Version mismatch, version %d requested but our version is %d\n", version, EPHY_PROFILE_MIGRATION_VERSION);
+    
+    return 1;
+  }
+
   ephy_debug_init ();
 
   if (!ephy_file_helpers_init (NULL, EPHY_FILE_HELPERS_NONE, NULL)) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]