mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 01:39:21 +03:00
utils: add executable for reading from datapack files
Summary: Useful for debugging the rust code. I used it to isolate a bug in the delta patching logic in the rust code. (Note: this ignores all push blocking failures!) Reviewed By: xavierd Differential Revision: D15380387 fbshipit-source-id: 5980d352b85ee4836bd654045eda2eae131e5847
This commit is contained in:
parent
bf10b4c037
commit
d0aaaeffe2
30
exec/utils/src/bin/datapack.rs
Normal file
30
exec/utils/src/bin/datapack.rs
Normal file
@ -0,0 +1,30 @@
|
||||
// Copyright 2019 Facebook, Inc.
|
||||
//
|
||||
// This software may be used and distributed according to the terms of the
|
||||
// GNU General Public License version 2 or any later version.
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use structopt::StructOpt;
|
||||
|
||||
use revisionstore::{datapack::DataPack, datastore::DataStore, uniondatastore::UnionDataStore};
|
||||
use types::{Key, Node, RepoPathBuf};
|
||||
|
||||
#[derive(StructOpt)]
|
||||
struct Cli {
|
||||
#[structopt(short = "n", parse(try_from_str = "Node::from_str"))]
|
||||
node: Node,
|
||||
#[structopt(short = "p")]
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = Cli::from_args();
|
||||
let pack = DataPack::new(&args.path).unwrap();
|
||||
let mut store = UnionDataStore::new();
|
||||
store.add(pack);
|
||||
|
||||
let key = Key::new(RepoPathBuf::new(), args.node);
|
||||
let result = store.get(&key).unwrap();
|
||||
println!("{:?}", String::from_utf8_lossy(&result));
|
||||
}
|
Loading…
Reference in New Issue
Block a user