From d2fede6129c0177a0d08dce95f3b87c8075eb73f Mon Sep 17 00:00:00 2001 From: Justin Milner <42585006+justinmilner1@users.noreply.github.com> Date: Thu, 4 Apr 2024 15:04:44 -0400 Subject: [PATCH] Resolve conflict, accept branch being merged in (#1076) * Resolve conflict, accept branch being merged in * remove accidental .gitignore add * whoops, put gitignore back * fix --------- Co-authored-by: Justin Milner --- .gitignore | 2 +- extensions/vscode/yarn.lock | 23 ++++------ sync/src/sync.rs | 71 ----------------------------- sync/src/sync/mod.rs | 89 ++++--------------------------------- 4 files changed, 19 insertions(+), 166 deletions(-) diff --git a/.gitignore b/.gitignore index 0517e3971..f8d2c8a18 100644 --- a/.gitignore +++ b/.gitignore @@ -152,4 +152,4 @@ continue_server.build continue_server.dist Icon -Icon? +Icon? \ No newline at end of file diff --git a/extensions/vscode/yarn.lock b/extensions/vscode/yarn.lock index 6e49e51c9..ffe1a3455 100644 --- a/extensions/vscode/yarn.lock +++ b/extensions/vscode/yarn.lock @@ -368,15 +368,15 @@ tar "^6.0.5" yargs "^17.0.1" -"@esbuild/darwin-arm64@0.17.19": +"@esbuild/linux-x64@0.17.19": version "0.17.19" - resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz" - integrity sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg== + resolved "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz" + integrity sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw== -"@esbuild/darwin-arm64@0.18.20": +"@esbuild/linux-x64@0.18.20": version "0.18.20" - resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz" - integrity sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA== + resolved "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz" + integrity sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w== "@eslint-community/eslint-utils@^4.2.0": version "4.4.0" @@ -691,10 +691,10 @@ resolved "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz" integrity sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg== -"@lancedb/vectordb-darwin-arm64@0.4.12": +"@lancedb/vectordb-linux-x64-gnu@0.4.12": version "0.4.12" - resolved "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.12.tgz" - integrity sha512-38/rkJRlWXkPWXuj9onzvbrhnIWcIUQjgEp5G9v5ixPosBowm7A4j8e2Q8CJMsVSNcVX2JLqwWVldiWegZFuYw== + resolved "https://registry.npmjs.org/@lancedb/vectordb-linux-x64-gnu/-/vectordb-linux-x64-gnu-0.4.12.tgz" + integrity sha512-gJqYR0aymrS+C60xc4EQPzmQ5/69XfeFv2ofBvAj7qW+c6BcnoAcfVl+7s1IrcWeGz251sm5cD5Lx4AzJd89dA== "@lukeed/csprng@^1.0.0": version "1.1.0" @@ -3445,11 +3445,6 @@ fs.realpath@^1.0.0: resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@^2.3.2, fsevents@~2.3.2: - version "2.3.3" - resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz" - integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== - function-bind@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz" diff --git a/sync/src/sync.rs b/sync/src/sync.rs index 460dcd785..d9e4791f2 100644 --- a/sync/src/sync.rs +++ b/sync/src/sync.rs @@ -45,21 +45,6 @@ fn remove_seps_from_path(dir: &Path) -> String { fn path_for_tag(tag: &Tag) -> PathBuf { let mut path = get_my_home().unwrap().unwrap(); path.push(".continue/index/tags"); -<<<<<<<< HEAD:sync/src/sync.rs - path.push(remove_seps_from_path(dir)); - if let Some(branch) = branch { - path.push(branch); - } else { - path.push("main"); - } - path -} - -// /// Stored in ~/.continue/index/.last_sync -// fn get_last_sync_time(dir: &Path, branch: Option<&str>) -> u64 { -// // TODO: Error handle here -// let path = path_for_tag(dir, branch).join(".last_sync"); -======== path.push(remove_seps_from_path(tag.dir)); path.push(tag.branch); path.push(tag.provider_id); @@ -70,7 +55,6 @@ fn path_for_tag(tag: &Tag) -> PathBuf { fn get_last_sync_time(tag: &Tag) -> u64 { // TODO: Error handle here let path = path_for_tag(tag).join(".last_sync"); ->>>>>>>> preview:sync/src/sync/mod.rs // let mut file = File::open(path).unwrap(); // let mut contents = String::new(); @@ -90,11 +74,6 @@ fn write_sync_time(tag: &Tag) { file.write_all(now.to_string().as_bytes()).unwrap(); } -<<<<<<<< HEAD:sync/src/sync.rs -// /// Use stat to find files since last sync time -// pub fn get_modified_files(dir: &Path, branch: Option<&str>) -> Vec { -// let last_sync_time = get_last_sync_time(dir, branch); -======== /// Use stat to find files since last sync time pub fn get_modified_files(tag: &Tag) -> Vec { let last_sync_time = get_last_sync_time(tag); @@ -104,7 +83,6 @@ pub fn get_modified_files(tag: &Tag) -> Vec { let path = entry.path(); let metadata = path.metadata().unwrap(); let modified = metadata.modified().unwrap(); ->>>>>>>> preview:sync/src/sync/mod.rs // build_walk(dir) // .filter_map(|entry| { @@ -226,29 +204,6 @@ impl<'a> IndexCache<'a> { } fn tag_str(&self) -> String { -<<<<<<<< HEAD:sync/src/sync.rs - format!("{}::{}", self.dir.to_str().unwrap(), self.branch) - } - - fn new(dir: &Path, branch: Option<&str>) -> Self { - Self { - dir: Box::from(dir), - branch: Box::from(branch.unwrap_or("main")), - global_cache: DiskSet::new( - get_my_home() - .unwrap() - .unwrap() - .join(".continue/index/.index_cache") - .to_str() - .unwrap(), - ), - tag_cache: DiskSet::new( - Self::index_cache_path_for_tag(dir, branch.unwrap_or("main")) - .to_str() - .unwrap(), - ), - } -======== return self.tag.to_string(); } @@ -270,21 +225,14 @@ impl<'a> IndexCache<'a> { ), tag_cache: DiskSet::new(IndexCache::index_cache_path_for_tag(tag).to_str().unwrap()), }; ->>>>>>>> preview:sync/src/sync/mod.rs } // rev_tags files are just json files with the following format: // { "hash": ["tag1", "tag2", ...], ... } // TODO: You could add_bulk, remove_bulk if this gets slow - -<<<<<<<< HEAD:sync/src/sync.rs - fn read_rev_tags(hash: [u8; ITEM_SIZE]) -> HashMap> { - let rev_tags_path = Self::rev_tags_path(hash); -======== fn read_rev_tags(&self, hash: [u8; ITEM_SIZE]) -> HashMap> { let rev_tags_path = IndexCache::rev_tags_path(hash, self.tag.provider_id); ->>>>>>>> preview:sync/src/sync/mod.rs let mut rev_tags_file = OpenOptions::new() .read(true) .write(true) @@ -297,13 +245,8 @@ impl<'a> IndexCache<'a> { serde_json::from_str(&contents).unwrap_or_default() } -<<<<<<<< HEAD:sync/src/sync.rs - fn write_rev_tags(hash: [u8; ITEM_SIZE], rev_tags: &HashMap>) { - let rev_tags_path = Self::rev_tags_path(hash); -======== fn write_rev_tags(&self, hash: [u8; ITEM_SIZE], rev_tags: HashMap>) { let rev_tags_path = IndexCache::rev_tags_path(hash, self.tag.provider_id); ->>>>>>>> preview:sync/src/sync/mod.rs let mut rev_tags_file = OpenOptions::new() .read(true) .write(true) @@ -532,37 +475,23 @@ mod tests { #[test] fn test_sync() { let ti = std::time::Instant::now(); -<<<<<<<< HEAD:sync/src/sync.rs - let _results = sync( - Path::new("/Users/natesesti/Desktop/continue"), - Some("nate/pyO3"), - ); -======== let tag = Tag { dir: Path::new("../"), branch: "nate/pyO3", provider_id: "default", }; let results = sync(&tag); ->>>>>>>> preview:sync/src/sync/mod.rs println!("Sync took {:?}", ti.elapsed()); // Vast majority (90+%) of this time is spent in compute_tree_for_dir } #[test] fn test_on_vscode_extension() { -<<<<<<<< HEAD:sync/src/sync.rs - let _results = sync( - Path::new("/Users/natesesti/Desktop/continue/extensions/vscode"), - Some("nate/pyO3"), - ); -======== let results = sync(&Tag { dir: Path::new("../extensions/vscode"), branch: "nate/pyO3", provider_id: "default", }); ->>>>>>>> preview:sync/src/sync/mod.rs } #[test] diff --git a/sync/src/sync/mod.rs b/sync/src/sync/mod.rs index 460dcd785..5bea1129e 100644 --- a/sync/src/sync/mod.rs +++ b/sync/src/sync/mod.rs @@ -45,21 +45,6 @@ fn remove_seps_from_path(dir: &Path) -> String { fn path_for_tag(tag: &Tag) -> PathBuf { let mut path = get_my_home().unwrap().unwrap(); path.push(".continue/index/tags"); -<<<<<<<< HEAD:sync/src/sync.rs - path.push(remove_seps_from_path(dir)); - if let Some(branch) = branch { - path.push(branch); - } else { - path.push("main"); - } - path -} - -// /// Stored in ~/.continue/index/.last_sync -// fn get_last_sync_time(dir: &Path, branch: Option<&str>) -> u64 { -// // TODO: Error handle here -// let path = path_for_tag(dir, branch).join(".last_sync"); -======== path.push(remove_seps_from_path(tag.dir)); path.push(tag.branch); path.push(tag.provider_id); @@ -70,7 +55,6 @@ fn path_for_tag(tag: &Tag) -> PathBuf { fn get_last_sync_time(tag: &Tag) -> u64 { // TODO: Error handle here let path = path_for_tag(tag).join(".last_sync"); ->>>>>>>> preview:sync/src/sync/mod.rs // let mut file = File::open(path).unwrap(); // let mut contents = String::new(); @@ -90,22 +74,16 @@ fn write_sync_time(tag: &Tag) { file.write_all(now.to_string().as_bytes()).unwrap(); } -<<<<<<<< HEAD:sync/src/sync.rs -// /// Use stat to find files since last sync time -// pub fn get_modified_files(dir: &Path, branch: Option<&str>) -> Vec { -// let last_sync_time = get_last_sync_time(dir, branch); -======== -/// Use stat to find files since last sync time -pub fn get_modified_files(tag: &Tag) -> Vec { - let last_sync_time = get_last_sync_time(tag); - let mut modified_files = Vec::new(); - for entry in build_walk(tag.dir) { - let entry = entry.unwrap(); - let path = entry.path(); - let metadata = path.metadata().unwrap(); - let modified = metadata.modified().unwrap(); ->>>>>>>> preview:sync/src/sync/mod.rs +/// Use stat to find files since last sync time +// pub fn get_modified_files(tag: &Tag) -> Vec { +// let last_sync_time = get_last_sync_time(tag); +// let mut modified_files = Vec::new(); +// for entry in build_walk(tag.dir) { +// let entry = entry.unwrap(); +// let path = entry.path(); +// let metadata = path.metadata().unwrap(); +// let modified = metadata.modified().unwrap(); // build_walk(dir) // .filter_map(|entry| { // let entry = entry.unwrap(); @@ -226,29 +204,6 @@ impl<'a> IndexCache<'a> { } fn tag_str(&self) -> String { -<<<<<<<< HEAD:sync/src/sync.rs - format!("{}::{}", self.dir.to_str().unwrap(), self.branch) - } - - fn new(dir: &Path, branch: Option<&str>) -> Self { - Self { - dir: Box::from(dir), - branch: Box::from(branch.unwrap_or("main")), - global_cache: DiskSet::new( - get_my_home() - .unwrap() - .unwrap() - .join(".continue/index/.index_cache") - .to_str() - .unwrap(), - ), - tag_cache: DiskSet::new( - Self::index_cache_path_for_tag(dir, branch.unwrap_or("main")) - .to_str() - .unwrap(), - ), - } -======== return self.tag.to_string(); } @@ -270,21 +225,14 @@ impl<'a> IndexCache<'a> { ), tag_cache: DiskSet::new(IndexCache::index_cache_path_for_tag(tag).to_str().unwrap()), }; ->>>>>>>> preview:sync/src/sync/mod.rs } // rev_tags files are just json files with the following format: // { "hash": ["tag1", "tag2", ...], ... } // TODO: You could add_bulk, remove_bulk if this gets slow - -<<<<<<<< HEAD:sync/src/sync.rs - fn read_rev_tags(hash: [u8; ITEM_SIZE]) -> HashMap> { - let rev_tags_path = Self::rev_tags_path(hash); -======== fn read_rev_tags(&self, hash: [u8; ITEM_SIZE]) -> HashMap> { let rev_tags_path = IndexCache::rev_tags_path(hash, self.tag.provider_id); ->>>>>>>> preview:sync/src/sync/mod.rs let mut rev_tags_file = OpenOptions::new() .read(true) .write(true) @@ -297,13 +245,8 @@ impl<'a> IndexCache<'a> { serde_json::from_str(&contents).unwrap_or_default() } -<<<<<<<< HEAD:sync/src/sync.rs - fn write_rev_tags(hash: [u8; ITEM_SIZE], rev_tags: &HashMap>) { - let rev_tags_path = Self::rev_tags_path(hash); -======== fn write_rev_tags(&self, hash: [u8; ITEM_SIZE], rev_tags: HashMap>) { let rev_tags_path = IndexCache::rev_tags_path(hash, self.tag.provider_id); ->>>>>>>> preview:sync/src/sync/mod.rs let mut rev_tags_file = OpenOptions::new() .read(true) .write(true) @@ -532,37 +475,23 @@ mod tests { #[test] fn test_sync() { let ti = std::time::Instant::now(); -<<<<<<<< HEAD:sync/src/sync.rs - let _results = sync( - Path::new("/Users/natesesti/Desktop/continue"), - Some("nate/pyO3"), - ); -======== let tag = Tag { dir: Path::new("../"), branch: "nate/pyO3", provider_id: "default", }; let results = sync(&tag); ->>>>>>>> preview:sync/src/sync/mod.rs println!("Sync took {:?}", ti.elapsed()); // Vast majority (90+%) of this time is spent in compute_tree_for_dir } #[test] fn test_on_vscode_extension() { -<<<<<<<< HEAD:sync/src/sync.rs - let _results = sync( - Path::new("/Users/natesesti/Desktop/continue/extensions/vscode"), - Some("nate/pyO3"), - ); -======== let results = sync(&Tag { dir: Path::new("../extensions/vscode"), branch: "nate/pyO3", provider_id: "default", }); ->>>>>>>> preview:sync/src/sync/mod.rs } #[test]