This commit is contained in:
Julian Ospald 2017-09-12 16:19:55 +02:00
parent 58993e58be
commit 18c9a5ec7a

View File

@ -3,6 +3,7 @@ use gtk::prelude::*;
use std::rc::Rc;
use gtk::WidgetExt;
use libpijul;
use libpijul::fs_representation::*;
use std::path::Path;
@ -47,7 +48,7 @@ pub fn init(appstate: Rc<AppS>) {
{
let ls = gtk::ListStore::new(&[gtk::Type::String]);
let branches = get_branches("/home/hasufell/git/pijul/.pijul/pristine");
let branches = get_branches("/home/hasufell/git/pijul");
for branch in branches {
ls.insert_with_values(None, &[0], &[&branch.as_str()]);
@ -69,7 +70,7 @@ pub fn init(appstate: Rc<AppS>) {
{
let ls = gtk::ListStore::new(&[gtk::Type::String]);
let patches = get_patches("/home/hasufell/git/pijul/.pijul/pristine",
let patches = get_patches("/home/hasufell/git/pijul",
"master");
for patch in patches {
ls.insert_with_values(None, &[0], &[&patch.as_str()]);
@ -96,7 +97,7 @@ pub fn init(appstate: Rc<AppS>) {
fn get_branches(path: &str) -> Vec<String> {
let mut vec = Vec::new();
let repo = libpijul::Repository::open(path, None).unwrap();
let repo = libpijul::Repository::open(pristine_dir(path), None).unwrap();
let txn = repo.txn_begin().unwrap();
let branches = txn.iter_branches(None).map(|x| String::from(x.name.as_str()));
@ -109,13 +110,13 @@ fn get_branches(path: &str) -> Vec<String> {
fn get_patches(path: &str, branch: &str) -> Vec<String> {
let mut vec = Vec::new();
let repo = libpijul::Repository::open(path, None).unwrap();
let repo = libpijul::Repository::open(pristine_dir(path), None).unwrap();
let txn = repo.txn_begin().unwrap();
let branch = txn.get_branch(branch).unwrap();
let patches = txn.iter_patches(&branch, None).map(|x| {
let p = libpijul::fs_representation::read_patch(Path::new("/home/hasufell/git/pijul"),
let p = libpijul::fs_representation::read_patch(Path::new(path),
txn.external_hash(x.0)).unwrap();
p.header().name.clone()
});