From 26e23da4c017c67fa836a2faa9c99ef7d505fd15 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Sun, 10 Apr 2016 17:15:40 +0300 Subject: [PATCH] some newver/oldver logics --- parity/main.rs | 11 +++++++++++ parity/upgrade.rs | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/parity/main.rs b/parity/main.rs index b605a9dd4..d625b9ef7 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -780,6 +780,17 @@ fn die_with_io_error(e: std::io::Error) -> ! { } fn main() { + match ::upgrade::upgrade() { + Ok(upgrades_applied) => { + if upgrades_applied > 0 { + println!("Executed {} upgrade scripts - ok", upgrades_applied); + } + }, + Err(e) => { + die!("Error upgrading parity data: {:?}", e); + } + } + Configuration::parse().execute(); } diff --git a/parity/upgrade.rs b/parity/upgrade.rs index 50861fa91..0b41b5892 100644 --- a/parity/upgrade.rs +++ b/parity/upgrade.rs @@ -18,11 +18,11 @@ use semver::Version; use std::collections::*; -use std::path::*; use std::fs::File; use std::env; use std::io::{Read, Write}; +#[derive(Debug)] pub enum Error { CannotLockVersionFile, CannotUpdateVersionFile, @@ -61,6 +61,7 @@ impl UpgradeKey { // dummy upgrade (remove when the first one is in) fn dummy_upgrade() -> Result<(), Error> { + println!("Adding ver.lock"); Ok(()) } @@ -68,7 +69,7 @@ fn push_updrades(upgrades: &mut UpgradeList) { // dummy upgrade (remove when the first one is in) upgrades.insert( - UpgradeKey { old_version: Version::parse("1.0.0").unwrap(), new_version: Version::parse("99.99.0").unwrap() }, + UpgradeKey { old_version: Version::parse("0.9.0").unwrap(), new_version: Version::parse("1.0.0").unwrap() }, dummy_upgrade); }