cleanup use

This commit is contained in:
Stephan 2020-06-29 12:30:10 +02:00
parent ce4f3af767
commit 4a442f3829
25 changed files with 76 additions and 70 deletions

View File

@ -1,12 +1,13 @@
use crate::{
error::Result, sync, AsyncNotification, StatusItem, CWD,
error::Result,
sync::{self, CommitId},
AsyncNotification, StatusItem, CWD,
};
use crossbeam_channel::Sender;
use std::sync::{
atomic::{AtomicUsize, Ordering},
Arc, Mutex,
};
use sync::CommitId;
type ResultType = Vec<StatusItem>;
struct Request<R, A>(R, A);

View File

@ -1,5 +1,8 @@
use crate::{
error::Result, hash, sync, AsyncNotification, FileDiff, CWD,
error::Result,
hash,
sync::{self, CommitId},
AsyncNotification, FileDiff, CWD,
};
use crossbeam_channel::Sender;
use std::{
@ -9,7 +12,6 @@ use std::{
Arc, Mutex,
},
};
use sync::CommitId;
///
#[derive(Hash, Clone, PartialEq)]

View File

@ -1,5 +1,8 @@
use crate::{
error::Result, hash, sync, AsyncNotification, StatusItem, CWD,
error::Result,
hash,
sync::{self, status::StatusType},
AsyncNotification, StatusItem, CWD,
};
use crossbeam_channel::Sender;
use std::{
@ -10,7 +13,6 @@ use std::{
},
time::{SystemTime, UNIX_EPOCH},
};
use sync::status::StatusType;
fn current_tick() -> u64 {
SystemTime::now()

View File

@ -1,6 +1,10 @@
//! sync git api for fetching a diff
use super::{commit_files::get_commit_diff, utils, CommitId};
use super::{
commit_files::get_commit_diff,
utils::{self, get_head_repo, work_dir},
CommitId,
};
use crate::{error::Error, error::Result, hash};
use git2::{
Delta, Diff, DiffDelta, DiffFormat, DiffHunk, DiffOptions, Patch,
@ -8,7 +12,6 @@ use git2::{
};
use scopetime::scope_time;
use std::{cell::RefCell, fs, path::Path, rc::Rc};
use utils::{get_head_repo, work_dir};
/// type of diff of a single line
#[derive(Copy, Clone, PartialEq, Hash, Debug)]

View File

@ -4,8 +4,7 @@ use scopetime::scope_time;
use std::{
fs::File,
io::{Read, Write},
path::Path,
path::PathBuf,
path::{Path, PathBuf},
process::Command,
};

View File

@ -1,4 +1,3 @@
use crate::input::InputState;
use crate::{
accessors,
cmdbar::CommandBar,
@ -8,10 +7,10 @@ use crate::{
InspectCommitComponent, MsgComponent, ResetComponent,
StashMsgComponent,
},
input::InputEvent,
input::{InputEvent, InputState},
keys,
queue::{Action, InternalEvent, NeedsUpdate, Queue},
strings,
strings::{self, commands, order},
tabs::{Revlog, StashList, Stashing, Status},
ui::style::{SharedTheme, Theme},
};
@ -19,9 +18,7 @@ use anyhow::{anyhow, Result};
use asyncgit::{sync, AsyncNotification, CWD};
use crossbeam_channel::Sender;
use crossterm::event::{Event, KeyEvent};
use std::cell::Cell;
use std::{cell::RefCell, rc::Rc};
use strings::{commands, order};
use std::{cell::Cell, cell::RefCell, rc::Rc};
use tui::{
backend::Backend,
layout::{Constraint, Direction, Layout, Rect},

View File

@ -6,12 +6,12 @@ use crate::{
get_app_config_path, keys,
queue::{InternalEvent, NeedsUpdate, Queue},
strings,
strings::COMMIT_EDITOR_MSG,
strings::{commands, COMMIT_EDITOR_MSG},
ui::style::SharedTheme,
};
use anyhow::{anyhow, Result};
use asyncgit::{
sync::{self, CommitId},
sync::{self, CommitId, HookResult},
CWD,
};
use crossterm::{
@ -20,13 +20,13 @@ use crossterm::{
ExecutableCommand,
};
use scopeguard::defer;
use std::env;
use std::fs::File;
use std::io::{self, Read, Write};
use std::path::PathBuf;
use std::process::Command;
use strings::commands;
use sync::HookResult;
use std::{
env,
fs::File,
io::{self, Read, Write},
path::PathBuf,
process::Command,
};
use tui::{backend::Backend, layout::Rect, Frame};
pub struct CommitComponent {

View File

@ -8,12 +8,11 @@ use crate::{
};
use anyhow::Result;
use asyncgit::{
sync::{self, CommitDetails},
sync::{self, CommitDetails, CommitId, Tags},
CWD,
};
use crossterm::event::Event;
use std::borrow::Cow;
use sync::{CommitId, Tags};
use tui::{
backend::Backend,
layout::{Constraint, Direction, Layout, Rect},

View File

@ -10,12 +10,11 @@ use crate::{
ui::style::{SharedTheme, Theme},
};
use anyhow::Result;
use asyncgit::sync;
use asyncgit::sync::Tags;
use crossterm::event::Event;
use std::{
borrow::Cow, cell::Cell, cmp, convert::TryFrom, time::Instant,
};
use sync::Tags;
use tui::{
backend::Backend,
layout::{Alignment, Rect},

View File

@ -3,14 +3,13 @@ use crate::{
components::{CommandInfo, Component},
keys,
queue::{Action, InternalEvent, NeedsUpdate, Queue, ResetItem},
strings,
strings::{self, commands},
ui::{calc_scroll_top, style::SharedTheme},
};
use asyncgit::{hash, sync, DiffLine, DiffLineType, FileDiff, CWD};
use bytesize::ByteSize;
use crossterm::event::Event;
use std::{borrow::Cow, cell::Cell, cmp, path::Path};
use strings::commands;
use tui::{
backend::Backend,
layout::{Alignment, Rect},

View File

@ -9,14 +9,14 @@ use crate::{
components::{CommandInfo, Component},
keys,
queue::{InternalEvent, NeedsUpdate, Queue},
strings, ui,
strings::{commands, order},
ui,
ui::style::SharedTheme,
};
use anyhow::Result;
use asyncgit::{hash, StatusItem, StatusItemType};
use crossterm::event::Event;
use std::{borrow::Cow, convert::From, path::Path};
use strings::{commands, order};
use tui::{backend::Backend, layout::Rect, widgets::Text, Frame};
///

View File

@ -2,12 +2,16 @@ use super::{
visibility_blocking, CommandBlocking, CommandInfo, Component,
DrawableComponent,
};
use crate::{keys, strings, ui, version::Version};
use crate::{
keys,
strings::{self, commands},
ui,
version::Version,
};
use asyncgit::hash;
use crossterm::event::Event;
use itertools::Itertools;
use std::{borrow::Cow, cmp, convert::TryFrom};
use strings::commands;
use tui::{
backend::Backend,
layout::{Alignment, Constraint, Direction, Layout, Rect},

View File

@ -4,16 +4,16 @@ use super::{
DrawableComponent,
};
use crate::{
accessors, keys, queue::Queue, strings, ui::style::SharedTheme,
accessors, keys, queue::Queue, strings::commands,
ui::style::SharedTheme,
};
use anyhow::Result;
use asyncgit::{
sync, AsyncDiff, AsyncNotification, DiffParams, DiffType,
sync::{CommitId, Tags},
AsyncDiff, AsyncNotification, DiffParams, DiffType,
};
use crossbeam_channel::Sender;
use crossterm::event::Event;
use strings::commands;
use sync::{CommitId, Tags};
use tui::{
backend::Backend,
layout::{Constraint, Direction, Layout, Rect},

View File

@ -12,13 +12,15 @@ mod reset;
mod stashmsg;
mod textinput;
mod utils;
use anyhow::Result;
use crossterm::event::Event;
pub use changes::ChangesComponent;
pub use command::{CommandInfo, CommandText};
pub use commit::CommitComponent;
pub use commit_details::CommitDetailsComponent;
pub use commitlist::CommitList;
use crossterm::event::Event;
pub use diff::DiffComponent;
pub use filetree::FileTreeComponent;
pub use help::HelpComponent;

View File

@ -2,10 +2,13 @@ use super::{
visibility_blocking, CommandBlocking, CommandInfo, Component,
DrawableComponent,
};
use crate::{keys, strings, ui};
use crate::{
keys,
strings::{self, commands},
ui,
};
use crossterm::event::Event;
use std::borrow::Cow;
use strings::commands;
use tui::{
backend::Backend,
layout::{Alignment, Rect},

View File

@ -4,12 +4,12 @@ use crate::{
CommandInfo, Component, DrawableComponent,
},
queue::{Action, InternalEvent, Queue},
strings, ui,
strings::{self, commands},
ui,
};
use anyhow::Result;
use crossterm::event::{Event, KeyCode};
use std::borrow::Cow;
use strings::commands;
use tui::{
backend::Backend,
layout::Rect,

View File

@ -4,14 +4,13 @@ use super::{
};
use crate::{
queue::{InternalEvent, NeedsUpdate, Queue},
strings,
strings::{self, commands},
tabs::StashingOptions,
ui::style::SharedTheme,
};
use anyhow::Result;
use asyncgit::{sync, CWD};
use crossterm::event::{Event, KeyCode};
use strings::commands;
use tui::{backend::Backend, layout::Rect, Frame};
pub struct StashMsgComponent {

View File

@ -3,11 +3,11 @@ use crate::{
popup_paragraph, visibility_blocking, CommandBlocking,
CommandInfo, Component, DrawableComponent,
},
strings, ui,
strings::commands,
ui::{self, style::SharedTheme},
};
use anyhow::Result;
use crossterm::event::{Event, KeyCode, KeyModifiers};
use strings::commands;
use tui::{
backend::Backend,
layout::Rect,
@ -15,7 +15,6 @@ use tui::{
widgets::{Clear, Text},
Frame,
};
use ui::style::SharedTheme;
/// primarily a subcomponet for user input of text (used in `CommitComponent`)
pub struct TextInputComponent {

View File

@ -1,14 +1,13 @@
use anyhow::Result;
use asyncgit::StatusItem;
use std::{
collections::BTreeSet,
convert::TryFrom,
ffi::OsStr,
ops::{Index, IndexMut},
path::Path,
};
use anyhow::Result;
use std::ffi::OsStr;
/// holds the information shared among all `FileTreeItem` in a `FileTree`
#[derive(Debug, Clone)]
pub struct TreeItemInfo {

View File

@ -6,15 +6,16 @@ use crate::{
},
keys,
queue::{InternalEvent, Queue},
strings,
strings::{self, commands},
ui::style::SharedTheme,
};
use anyhow::Result;
use asyncgit::{sync, AsyncLog, AsyncNotification, FetchStatus, CWD};
use asyncgit::{
sync::{self, CommitId},
AsyncLog, AsyncNotification, FetchStatus, CWD,
};
use crossbeam_channel::Sender;
use crossterm::event::Event;
use strings::commands;
use sync::CommitId;
use tui::{
backend::Backend,
layout::{Constraint, Direction, Layout, Rect},

View File

@ -7,7 +7,7 @@ use crate::{
},
keys,
queue::{InternalEvent, Queue},
strings,
strings::{self, commands},
ui::style::SharedTheme,
};
use anyhow::Result;
@ -18,7 +18,6 @@ use asyncgit::{
use crossbeam_channel::Sender;
use crossterm::event::Event;
use std::borrow::Cow;
use strings::commands;
use tui::{
layout::{Alignment, Constraint, Direction, Layout},
widgets::{Block, Borders, Paragraph, Text},

View File

@ -5,15 +5,15 @@ use crate::{
},
keys,
queue::{Action, InternalEvent, Queue},
strings,
strings::{self, commands},
ui::style::SharedTheme,
};
use anyhow::Result;
use asyncgit::sync;
use asyncgit::CWD;
use asyncgit::{
sync::{self, CommitId},
CWD,
};
use crossterm::event::Event;
use strings::commands;
use sync::CommitId;
pub struct StashList {
list: CommitList,

View File

@ -1,13 +1,13 @@
use crate::{
accessors,
components::{
self, event_pump, ChangesComponent, CommandBlocking,
CommandInfo, Component, DiffComponent, DrawableComponent,
FileTreeItemKind,
command_pump, event_pump, visibility_blocking,
ChangesComponent, CommandBlocking, CommandInfo, Component,
DiffComponent, DrawableComponent, FileTreeItemKind,
},
keys,
queue::{InternalEvent, Queue, ResetItem},
strings,
strings::{self, commands, order},
ui::style::SharedTheme,
};
use anyhow::Result;
@ -16,10 +16,8 @@ use asyncgit::{
AsyncDiff, AsyncNotification, AsyncStatus, DiffParams, DiffType,
StatusParams, CWD,
};
use components::{command_pump, visibility_blocking};
use crossbeam_channel::Sender;
use crossterm::event::Event;
use strings::{commands, order};
use tui::layout::{Constraint, Direction, Layout};
///

View File

@ -1,5 +1,6 @@
mod scrolllist;
pub mod style;
use scrolllist::ScrollableList;
use style::SharedTheme;
use tui::{

View File

@ -6,10 +6,10 @@ use ron::{
ser::{to_string_pretty, PrettyConfig},
};
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use std::{
fs::File,
io::{Read, Write},
path::PathBuf,
rc::Rc,
};
use tui::style::{Color, Modifier, Style};