From 7c247116b94880b4bd0eabc237952288826db575 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Thu, 17 Feb 2022 22:34:39 -0800 Subject: [PATCH] repo: remove code for upgrading old repos to have `.jj/store/git/` 1b6efdc3f8ed moved `.jj/git/` into `.jj/store/` for consistency with the layout of native stores. It provided automatic format upgrades for repos with the old format. It's been about four months now, so let's remove the migration code. --- lib/src/repo.rs | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/lib/src/repo.rs b/lib/src/repo.rs index 6ef89878d..b2e2f7c7e 100644 --- a/lib/src/repo.rs +++ b/lib/src/repo.rs @@ -16,8 +16,6 @@ use std::cell::RefCell; use std::collections::{HashMap, HashSet}; use std::fmt::{Debug, Formatter}; use std::fs; -use std::fs::File; -use std::io::Read; use std::ops::Deref; use std::path::{Path, PathBuf}; use std::sync::{Arc, Mutex}; @@ -298,27 +296,6 @@ pub struct RepoLoader { impl RepoLoader { pub fn init(user_settings: &UserSettings, repo_path: PathBuf) -> Self { - let store_path = repo_path.join("store"); - if store_path.is_file() { - // This is the old format. Let's be nice and upgrade any existing repos. - // TODO: Delete this in early 2022 or so - println!("The repo format has changed. Upgrading..."); - let mut buf = vec![]; - { - let mut store_file = File::open(&store_path).unwrap(); - store_file.read_to_end(&mut buf).unwrap(); - } - let contents = String::from_utf8(buf).unwrap(); - assert!(contents.starts_with("git: ")); - let git_backend_path_str = contents[5..].to_string(); - fs::remove_file(&store_path).unwrap(); - fs::create_dir(&store_path).unwrap(); - if repo_path.join("git").is_dir() { - fs::rename(repo_path.join("git"), store_path.join("git")).unwrap(); - } - fs::write(store_path.join("git_target"), &git_backend_path_str).unwrap(); - println!("Done. .jj/git is now .jj/store/git"); - } let store = Store::load_store(repo_path.join("store")); let repo_settings = user_settings.with_repo(&repo_path).unwrap(); let op_store: Arc = Arc::new(SimpleOpStore::load(repo_path.join("op_store")));