mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-08-17 00:00:31 +03:00
less noise in logs
This commit is contained in:
parent
5f03fcb2df
commit
8bfdc14a46
16
README.md
16
README.md
@ -5,7 +5,7 @@
|
||||
[see here](https://tauri.app/v1/guides/getting-started/prerequisites)
|
||||
for the list of software required to build / develope the app.
|
||||
|
||||
## Setup
|
||||
### Setup
|
||||
|
||||
Then, make sure to install app dependencies:
|
||||
|
||||
@ -13,9 +13,7 @@ Then, make sure to install app dependencies:
|
||||
$ pnpm install
|
||||
```
|
||||
|
||||
## Develop
|
||||
|
||||
### Running the app
|
||||
### Run the app
|
||||
|
||||
Now you should be able to run the app in development mode:
|
||||
|
||||
@ -23,6 +21,12 @@ Now you should be able to run the app in development mode:
|
||||
$ pnpm tauri dev
|
||||
```
|
||||
|
||||
By default it will not print debug logs to console. If you want debug logs, use `debug` feature:
|
||||
|
||||
```bash
|
||||
$ pnpm tauri dev --features debug
|
||||
```
|
||||
|
||||
### Run Stories
|
||||
|
||||
Stories is our easy way to view our app components. Running the following command will launch in your default browser.
|
||||
@ -33,14 +37,14 @@ $ pnpm story:dev
|
||||
|
||||
### Lint & format
|
||||
|
||||
Frontend:
|
||||
Javascript:
|
||||
|
||||
```bash
|
||||
$ pnpm lint
|
||||
$ pnpm format
|
||||
```
|
||||
|
||||
Backend:
|
||||
Rust:
|
||||
|
||||
```bash
|
||||
$ cd ./src-tauri
|
||||
|
@ -66,6 +66,8 @@ resolve-path = "0.1.0"
|
||||
# by default Tauri runs in production mode
|
||||
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
|
||||
default = ["custom-protocol"]
|
||||
# enabled debug logging
|
||||
debug = []
|
||||
# this feature enables devtools
|
||||
devtools = ["tauri/devtools"]
|
||||
# this feature is used used for production builds where `devPath` points to the filesystem
|
||||
|
@ -538,11 +538,11 @@ impl App {
|
||||
project_repository.git_unstage_files(paths)
|
||||
}
|
||||
|
||||
pub fn git_commit(&self, project_id: &str, message: &str, push: bool) -> Result<()> {
|
||||
pub fn git_commit(&self, project_id: &str, message: &str) -> Result<()> {
|
||||
let project = self.gb_project(project_id)?;
|
||||
let project_repository = project_repository::Repository::open(&project)
|
||||
.context("failed to open project repository")?;
|
||||
project_repository.git_commit(message, push)
|
||||
project_repository.git_commit(message)
|
||||
}
|
||||
|
||||
pub fn search(&self, query: &search::Query) -> Result<search::Results> {
|
||||
|
@ -69,7 +69,7 @@ impl Proxy {
|
||||
return Ok(build_asset_url(&save_to.display().to_string()));
|
||||
}
|
||||
|
||||
tracing::info!("Downloading image {}", src);
|
||||
tracing::debug!("Downloading image {}", src);
|
||||
|
||||
let resp = reqwest::get(src.clone()).await?;
|
||||
if !resp.status().is_success() {
|
||||
|
@ -24,7 +24,7 @@ impl<'writer> BookmarksWriter<'writer> {
|
||||
[bookmark],
|
||||
)?;
|
||||
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"{}: wrote bookmark {}",
|
||||
self.repository.project_id,
|
||||
bookmark.timestamp_ms
|
||||
|
@ -31,7 +31,7 @@ impl<'writer> DeltasWriter<'writer> {
|
||||
self.writer
|
||||
.write_string(&format!("session/deltas/{}", path.display()), &raw_deltas)?;
|
||||
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"{}: wrote deltas for {}",
|
||||
self.repository.project_id,
|
||||
path.display()
|
||||
@ -51,7 +51,7 @@ impl<'writer> DeltasWriter<'writer> {
|
||||
self.writer
|
||||
.write_string(&format!("session/wd/{}", path.display()), contents)?;
|
||||
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"{}: wrote session wd file {}",
|
||||
self.repository.project_id,
|
||||
path.display()
|
||||
|
@ -21,7 +21,7 @@ impl Sender {
|
||||
self.app_handle
|
||||
.emit_all(&event.name, Some(&event.payload))
|
||||
.context("emit event")?;
|
||||
tracing::info!("sent event: {}", event.name);
|
||||
tracing::debug!("sent event: {}", event.name);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ impl Repository {
|
||||
|
||||
let mut callbacks = git2::RemoteCallbacks::new();
|
||||
callbacks.push_update_reference(move |refname, message| {
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"{}: pulling reference '{}': {:?}",
|
||||
self.project_id,
|
||||
refname,
|
||||
@ -174,7 +174,7 @@ impl Repository {
|
||||
Result::Ok(())
|
||||
});
|
||||
callbacks.push_transfer_progress(move |one, two, three| {
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"{}: transferred {}/{}/{} objects",
|
||||
self.project_id,
|
||||
one,
|
||||
@ -211,7 +211,7 @@ impl Repository {
|
||||
// Set the remote's callbacks
|
||||
let mut callbacks = git2::RemoteCallbacks::new();
|
||||
callbacks.push_update_reference(move |refname, message| {
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"{}: pushing reference '{}': {:?}",
|
||||
self.project_id,
|
||||
refname,
|
||||
@ -220,7 +220,7 @@ impl Repository {
|
||||
Result::Ok(())
|
||||
});
|
||||
callbacks.push_transfer_progress(move |one, two, three| {
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"{}: transferred {}/{}/{} objects",
|
||||
self.project_id,
|
||||
one,
|
||||
@ -322,8 +322,6 @@ impl Repository {
|
||||
&self,
|
||||
project_repository: &project_repository::Repository,
|
||||
) -> Result<sessions::Session> {
|
||||
tracing::info!("{}: creating new session", self.project_id);
|
||||
|
||||
let now_ms = time::SystemTime::now()
|
||||
.duration_since(time::UNIX_EPOCH)
|
||||
.unwrap()
|
||||
@ -355,6 +353,8 @@ impl Repository {
|
||||
.write(&session)
|
||||
.context("failed to write session")?;
|
||||
|
||||
tracing::info!("{}: created new session {}", self.project_id, session.id);
|
||||
|
||||
Ok(session)
|
||||
}
|
||||
|
||||
@ -575,7 +575,7 @@ impl Repository {
|
||||
let reference = repo.find_reference(&refname);
|
||||
match reference {
|
||||
Err(git::Error::NotFound(_)) => {
|
||||
tracing::warn!(
|
||||
tracing::debug!(
|
||||
"{}: reference {} not found, no migration",
|
||||
project.id,
|
||||
refname
|
||||
@ -621,7 +621,6 @@ impl Repository {
|
||||
}
|
||||
};
|
||||
|
||||
tracing::warn!("{}: migrated commit {}", project.id, id);
|
||||
migrated = true
|
||||
}
|
||||
|
||||
|
@ -48,14 +48,14 @@ pub fn for_key(key: &keys::Key) -> Vec<CredentialsCallback<'_>> {
|
||||
fn from_keypath(key_path: std::path::PathBuf, passphrase: Option<&str>) -> CredentialsCallback {
|
||||
Box::new(move |url, _username_from_url, _allowed_types| {
|
||||
let key_path = key_path.resolve();
|
||||
tracing::info!("authenticating with {} using {}", url, key_path.display());
|
||||
tracing::debug!("authenticating with {} using {}", url, key_path.display());
|
||||
git2::Cred::ssh_key("git", None, &key_path, passphrase)
|
||||
})
|
||||
}
|
||||
|
||||
fn from_key(key: &keys::PrivateKey) -> CredentialsCallback {
|
||||
Box::new(|url, _username_from_url, _allowed_types| {
|
||||
tracing::info!("authenticating with {} using gitbutler's key", url);
|
||||
tracing::debug!("authenticating with {} using gitbutler's key", url);
|
||||
git2::Cred::ssh_key_from_memory("git", None, &key.to_string(), None)
|
||||
})
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ use crate::error::Error;
|
||||
use super::{storage::Storage, PublicKey};
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "get_public_key", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
pub async fn get_public_key(handle: tauri::AppHandle) -> Result<PublicKey, Error> {
|
||||
let controller = Storage::from(&handle);
|
||||
let key = controller.get_or_create()?;
|
||||
|
@ -11,6 +11,7 @@ pub struct FileLock {
|
||||
}
|
||||
|
||||
impl FileLock {
|
||||
#[instrument(level = "debug")]
|
||||
pub fn lock(path: PathBuf) -> FileLock {
|
||||
let mut options = OpenOptions::new();
|
||||
options.create_new(true);
|
||||
@ -51,7 +52,6 @@ impl FileLock {
|
||||
}
|
||||
|
||||
impl Drop for FileLock {
|
||||
#[instrument(skip_all)]
|
||||
fn drop(&mut self) {
|
||||
std::fs::remove_file(&self.path).expect("failed to delete lock file");
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ pub struct FileLock {
|
||||
}
|
||||
|
||||
impl FileLock {
|
||||
#[instrument(level = "debug")]
|
||||
pub fn lock(path: PathBuf) -> FileLock {
|
||||
loop {
|
||||
// Create lockfile, or open pre-existing one
|
||||
@ -33,7 +34,6 @@ impl FileLock {
|
||||
}
|
||||
|
||||
impl Drop for FileLock {
|
||||
#[instrument(skip_all)]
|
||||
fn drop(&mut self) {
|
||||
// Removing the file isn't strictly necessary, but reduces confusion.
|
||||
_ = std::fs::remove_file(&self.path);
|
||||
|
@ -18,11 +18,14 @@ pub fn init(app_handle: &AppHandle) {
|
||||
let format_for_humans = tracing_subscriber::fmt::format()
|
||||
.with_file(true)
|
||||
.with_line_number(true)
|
||||
.with_thread_ids(true)
|
||||
.with_target(false)
|
||||
.compact();
|
||||
|
||||
let filter_for_humans = LevelFilter::DEBUG;
|
||||
let log_level_filter = if cfg!(feature = "debug") {
|
||||
LevelFilter::DEBUG
|
||||
} else {
|
||||
LevelFilter::INFO
|
||||
};
|
||||
|
||||
let subscriber = tracing_subscriber::registry()
|
||||
.with(
|
||||
@ -38,15 +41,15 @@ pub fn init(app_handle: &AppHandle) {
|
||||
// subscriber that writes spans to stdout
|
||||
tracing_subscriber::fmt::layer()
|
||||
.event_format(format_for_humans.clone())
|
||||
.with_filter(filter_for_humans),
|
||||
.with_span_events(FmtSpan::CLOSE)
|
||||
.with_filter(log_level_filter),
|
||||
)
|
||||
.with(
|
||||
// subscriber that writes spans to a file
|
||||
tracing_subscriber::fmt::layer()
|
||||
.event_format(format_for_humans)
|
||||
.with_span_events(FmtSpan::NEW | FmtSpan::CLOSE)
|
||||
.with_writer(file_writer)
|
||||
.with_filter(filter_for_humans),
|
||||
.with_writer(file_writer),
|
||||
);
|
||||
|
||||
set_global_default(subscriber).expect("failed to set subscriber");
|
||||
|
@ -13,7 +13,7 @@ use git_butler_tauri::*;
|
||||
use crate::{error::Error, git, project_repository::activity};
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "get_project_archive_path", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn get_project_archive_path(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -29,7 +29,7 @@ async fn get_project_archive_path(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "get_project_data_archive_path", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn get_project_data_archive_path(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -47,7 +47,7 @@ async fn get_project_data_archive_path(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "get_logs_archive_path", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn get_logs_archive_path(handle: tauri::AppHandle) -> Result<String, Error> {
|
||||
let zipper = handle.state::<zip::Zipper>();
|
||||
let zipped_logs = zipper.zip(handle.path_resolver().app_log_dir().unwrap())?;
|
||||
@ -55,7 +55,7 @@ async fn get_logs_archive_path(handle: tauri::AppHandle) -> Result<String, Error
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "search", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn search(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -83,7 +83,7 @@ async fn search(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "list_sessions", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn list_sessions(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -97,7 +97,7 @@ async fn list_sessions(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "get_user", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn get_user(handle: tauri::AppHandle) -> Result<Option<users::User>, Error> {
|
||||
let app = handle.state::<app::App>();
|
||||
let proxy = handle.state::<assets::Proxy>();
|
||||
@ -125,7 +125,7 @@ async fn get_user(handle: tauri::AppHandle) -> Result<Option<users::User>, Error
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "set_user", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn set_user(handle: tauri::AppHandle, user: users::User) -> Result<(), Error> {
|
||||
let app = handle.state::<app::App>();
|
||||
|
||||
@ -137,7 +137,7 @@ async fn set_user(handle: tauri::AppHandle, user: users::User) -> Result<(), Err
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "delete_user", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn delete_user(handle: tauri::AppHandle) -> Result<(), Error> {
|
||||
let app = handle.state::<app::App>();
|
||||
|
||||
@ -149,7 +149,7 @@ async fn delete_user(handle: tauri::AppHandle) -> Result<(), Error> {
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "update_project", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn update_project(
|
||||
handle: tauri::AppHandle,
|
||||
project: projects::UpdateRequest,
|
||||
@ -167,7 +167,7 @@ async fn update_project(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "add_project", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn add_project(handle: tauri::AppHandle, path: &str) -> Result<projects::Project, Error> {
|
||||
let app = handle.state::<app::App>();
|
||||
let project = app.add_project(path)?;
|
||||
@ -175,7 +175,7 @@ async fn add_project(handle: tauri::AppHandle, path: &str) -> Result<projects::P
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "get_project", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn get_project(
|
||||
handle: tauri::AppHandle,
|
||||
id: &str,
|
||||
@ -186,7 +186,7 @@ async fn get_project(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "list_projects", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn list_projects(handle: tauri::AppHandle) -> Result<Vec<projects::Project>, Error> {
|
||||
let app = handle.state::<app::App>();
|
||||
|
||||
@ -196,7 +196,7 @@ async fn list_projects(handle: tauri::AppHandle) -> Result<Vec<projects::Project
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "delete_project", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn delete_project(handle: tauri::AppHandle, id: &str) -> Result<(), Error> {
|
||||
let app = handle.state::<app::App>();
|
||||
|
||||
@ -207,7 +207,7 @@ async fn delete_project(handle: tauri::AppHandle, id: &str) -> Result<(), Error>
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "list_session_files", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn list_session_files(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -227,7 +227,7 @@ async fn list_session_files(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "list_deltas", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn list_deltas(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -247,7 +247,7 @@ async fn list_deltas(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_activity", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_activity(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -261,7 +261,7 @@ async fn git_activity(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_status", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_status(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -274,7 +274,7 @@ async fn git_status(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_wd_diff", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_wd_diff(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -288,7 +288,7 @@ async fn git_wd_diff(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_commit_diff", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_commit_diff(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -307,7 +307,7 @@ async fn git_commit_diff(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_match_paths", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_match_paths(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -326,7 +326,7 @@ async fn git_match_paths(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_branches", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_branches(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -339,7 +339,7 @@ async fn git_branches(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_remote_branches", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_remote_branches(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -355,7 +355,7 @@ async fn git_remote_branches(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_remote_branches_data", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_remote_branches_data(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -409,7 +409,7 @@ async fn git_remote_branches_data(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_head", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_head(handle: tauri::AppHandle, project_id: &str) -> Result<String, Error> {
|
||||
let app = handle.state::<app::App>();
|
||||
let head = app
|
||||
@ -419,7 +419,7 @@ async fn git_head(handle: tauri::AppHandle, project_id: &str) -> Result<String,
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_switch_branch", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_switch_branch(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -435,7 +435,7 @@ async fn git_switch_branch(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_stage", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_stage(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -448,7 +448,7 @@ async fn git_stage(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_unstage", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_unstage(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -461,21 +461,20 @@ async fn git_unstage(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_commit", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_commit(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
message: &str,
|
||||
push: bool,
|
||||
) -> Result<(), Error> {
|
||||
let app = handle.state::<app::App>();
|
||||
app.git_commit(project_id, message, push)
|
||||
app.git_commit(project_id, message)
|
||||
.with_context(|| format!("failed to commit for project {}", project_id))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "delete_all_data", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn delete_all_data(handle: tauri::AppHandle) -> Result<(), Error> {
|
||||
let app = handle.state::<app::App>();
|
||||
app.delete_all_data().context("failed to delete all data")?;
|
||||
@ -483,7 +482,7 @@ async fn delete_all_data(handle: tauri::AppHandle) -> Result<(), Error> {
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "upsert_bookmark", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn upsert_bookmark(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: String,
|
||||
@ -512,7 +511,7 @@ async fn upsert_bookmark(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "list_bookmarks", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn list_bookmarks(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -526,7 +525,7 @@ async fn list_bookmarks(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "fetch_from_target", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn fetch_from_target(handle: tauri::AppHandle, project_id: &str) -> Result<(), Error> {
|
||||
let app = handle.state::<app::App>();
|
||||
app.fetch_from_target(project_id)?;
|
||||
@ -534,7 +533,7 @@ async fn fetch_from_target(handle: tauri::AppHandle, project_id: &str) -> Result
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "mark_resolved", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn mark_resolved(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -546,7 +545,7 @@ async fn mark_resolved(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_set_config", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_set_config(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -559,7 +558,7 @@ async fn git_set_config(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_get_config", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_get_config(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: &str,
|
||||
@ -571,7 +570,7 @@ async fn git_get_config(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_set_global_config", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_set_global_config(
|
||||
handle: tauri::AppHandle,
|
||||
key: &str,
|
||||
@ -583,7 +582,7 @@ async fn git_set_global_config(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "git_get_global_config", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
async fn git_get_global_config(
|
||||
handle: tauri::AppHandle,
|
||||
key: &str,
|
||||
@ -621,7 +620,7 @@ async fn main() {
|
||||
let item_handle = app_handle.tray_handle().get_item(&id);
|
||||
match id.as_str() {
|
||||
"quit" => {
|
||||
tracing::info!("App exited");
|
||||
tracing::info!("Quitting app");
|
||||
app_handle.exit(0);
|
||||
}
|
||||
"toggle" => match get_window(app_handle) {
|
||||
@ -783,29 +782,33 @@ fn get_window(handle: &tauri::AppHandle) -> Option<tauri::Window> {
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
fn create_window(handle: &tauri::AppHandle) -> tauri::Result<tauri::Window> {
|
||||
tracing::info!("Creating window");
|
||||
let app_title = handle.package_info().name.clone();
|
||||
tauri::WindowBuilder::new(handle, "main", tauri::WindowUrl::App("index.html".into()))
|
||||
.resizable(true)
|
||||
.title(app_title)
|
||||
.disable_file_drop_handler()
|
||||
.min_inner_size(600.0, 300.0)
|
||||
.inner_size(800.0, 600.0)
|
||||
.build()
|
||||
let window =
|
||||
tauri::WindowBuilder::new(handle, "main", tauri::WindowUrl::App("index.html".into()))
|
||||
.resizable(true)
|
||||
.title(app_title)
|
||||
.disable_file_drop_handler()
|
||||
.min_inner_size(600.0, 300.0)
|
||||
.inner_size(800.0, 600.0)
|
||||
.build()?;
|
||||
tracing::info!("app window created");
|
||||
Ok(window)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn create_window(handle: &tauri::AppHandle) -> tauri::Result<tauri::Window> {
|
||||
tracing::info!("Creating window");
|
||||
tauri::WindowBuilder::new(handle, "main", tauri::WindowUrl::App("index.html".into()))
|
||||
.resizable(true)
|
||||
.title(handle.package_info().name.clone())
|
||||
.min_inner_size(1024.0, 600.0)
|
||||
.inner_size(1024.0, 600.0)
|
||||
.hidden_title(true)
|
||||
.disable_file_drop_handler()
|
||||
.title_bar_style(tauri::TitleBarStyle::Overlay)
|
||||
.build()
|
||||
let window =
|
||||
tauri::WindowBuilder::new(handle, "main", tauri::WindowUrl::App("index.html".into()))
|
||||
.resizable(true)
|
||||
.title(handle.package_info().name.clone())
|
||||
.min_inner_size(1024.0, 600.0)
|
||||
.inner_size(1024.0, 600.0)
|
||||
.hidden_title(true)
|
||||
.disable_file_drop_handler()
|
||||
.title_bar_style(tauri::TitleBarStyle::Overlay)
|
||||
.build()?;
|
||||
tracing::info!("window created");
|
||||
Ok(window)
|
||||
}
|
||||
|
||||
fn set_toggle_menu_hide(handle: &tauri::AppHandle) -> tauri::Result<()> {
|
||||
|
@ -1,4 +1,4 @@
|
||||
use std::{collections::HashMap, env, path};
|
||||
use std::{collections::HashMap, path};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use serde::Serialize;
|
||||
@ -423,27 +423,24 @@ impl<'repository> Repository<'repository> {
|
||||
let mut remote_callbacks = git2::RemoteCallbacks::new();
|
||||
remote_callbacks.credentials(credential_callback);
|
||||
|
||||
tracing::info!(
|
||||
"{}: git push {} {}:refs/heads/{}",
|
||||
self.project.id,
|
||||
branch.remote(),
|
||||
head,
|
||||
branch.branch()
|
||||
);
|
||||
|
||||
match remote.push(
|
||||
&[&format!("{}:refs/heads/{}", head, branch.branch())],
|
||||
Some(&mut git2::PushOptions::new().remote_callbacks(remote_callbacks)),
|
||||
) {
|
||||
Ok(()) => {
|
||||
tracing::info!("{}: git push succeeded", self.project.id);
|
||||
tracing::info!(
|
||||
"{}: git pushed branch {} to {}:refs/heads/{}",
|
||||
self.project.id,
|
||||
branch.remote(),
|
||||
head,
|
||||
branch.branch()
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
Err(git::Error::AuthenticationFailed(e)) => {
|
||||
tracing::info!("{}: git push failed: {:#}", self.project.id, e);
|
||||
Err(e) => {
|
||||
tracing::error!("{}: git push failed: {:#}", self.project.id, e);
|
||||
continue;
|
||||
}
|
||||
Err(e) => return Err(Error::Other(e.into())),
|
||||
}
|
||||
}
|
||||
|
||||
@ -461,7 +458,7 @@ impl<'repository> Repository<'repository> {
|
||||
remote_callbacks.credentials(credential_callback);
|
||||
remote_callbacks.push_update_reference(|refname, message| {
|
||||
if let Some(msg) = message {
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"{}: push update reference: {}: {}",
|
||||
self.project.id,
|
||||
refname,
|
||||
@ -471,7 +468,7 @@ impl<'repository> Repository<'repository> {
|
||||
Ok(())
|
||||
});
|
||||
remote_callbacks.push_negotiation(|proposals| {
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"{}: push negotiation: {:?}",
|
||||
self.project.id,
|
||||
proposals
|
||||
@ -487,7 +484,7 @@ impl<'repository> Repository<'repository> {
|
||||
Ok(())
|
||||
});
|
||||
remote_callbacks.push_transfer_progress(|one, two, three| {
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"{}: push transfer progress: {} {} {}",
|
||||
self.project.id,
|
||||
one,
|
||||
@ -501,11 +498,10 @@ impl<'repository> Repository<'repository> {
|
||||
fetch_opts.prune(git2::FetchPrune::On);
|
||||
|
||||
let refspec = &format!("+refs/heads/*:refs/remotes/{}/*", remote_name);
|
||||
tracing::info!("{}: git fetch {}", self.project.id, &refspec);
|
||||
|
||||
match remote.fetch(&[refspec], Some(&mut fetch_opts)) {
|
||||
Ok(()) => {
|
||||
tracing::info!("{}: fetched {}", self.project.id, remote_name);
|
||||
tracing::info!("{}: git fetched {}", self.project.id, &refspec);
|
||||
return Ok(());
|
||||
}
|
||||
Err(e) => {
|
||||
@ -518,7 +514,7 @@ impl<'repository> Repository<'repository> {
|
||||
Err(Error::AuthError)
|
||||
}
|
||||
|
||||
pub fn git_commit(&self, message: &str, push: bool) -> Result<()> {
|
||||
pub fn git_commit(&self, message: &str) -> Result<()> {
|
||||
let config = self
|
||||
.git_repository
|
||||
.config()
|
||||
@ -538,7 +534,7 @@ impl<'repository> Repository<'repository> {
|
||||
let tree_id = self.git_repository.index()?.write_tree()?;
|
||||
let tree = self.git_repository.find_tree(tree_id)?;
|
||||
let parent_commit = self.git_repository.head()?.peel_to_commit()?;
|
||||
let commit = self.git_repository.commit(
|
||||
let commit_oid = self.git_repository.commit(
|
||||
Some("HEAD"),
|
||||
&signature,
|
||||
&signature,
|
||||
@ -546,58 +542,13 @@ impl<'repository> Repository<'repository> {
|
||||
&tree,
|
||||
&[&parent_commit],
|
||||
)?;
|
||||
tracing::info!("{}: created commit {}", self.project.id, commit);
|
||||
|
||||
if push {
|
||||
// Get a reference to the current branch
|
||||
let head = self.git_repository.head()?;
|
||||
let branch = head.name().unwrap();
|
||||
|
||||
let branch_remote_name = self.git_repository.branch_upstream_remote(branch)?;
|
||||
let branch_name = self.git_repository.branch_upstream_name(branch)?;
|
||||
|
||||
tracing::info!(
|
||||
"{}: pushing {} to {} as {}",
|
||||
self.project.id,
|
||||
branch,
|
||||
branch_remote_name,
|
||||
branch_name,
|
||||
);
|
||||
|
||||
// Set the remote's callbacks
|
||||
let mut callbacks = git2::RemoteCallbacks::new();
|
||||
|
||||
callbacks.push_update_reference(move |refname, message| {
|
||||
tracing::info!("pushing reference '{}': {:?}", refname, message);
|
||||
Ok(())
|
||||
});
|
||||
callbacks.push_transfer_progress(move |one, two, three| {
|
||||
tracing::info!("transferred {}/{}/{} objects", one, two, three);
|
||||
});
|
||||
|
||||
// create ssh key if it's not there
|
||||
|
||||
// try to auth with creds from an ssh-agent
|
||||
callbacks.credentials(|_url, username_from_url, _allowed_types| {
|
||||
git2::Cred::ssh_key(
|
||||
username_from_url.unwrap(),
|
||||
None,
|
||||
std::path::Path::new(&format!("{}/.ssh/id_ed25519", env::var("HOME").unwrap())),
|
||||
None,
|
||||
)
|
||||
});
|
||||
|
||||
let mut push_options = git2::PushOptions::new();
|
||||
push_options.remote_callbacks(callbacks);
|
||||
|
||||
// Push to the remote
|
||||
let mut remote = self.git_repository.find_remote(&branch_remote_name)?;
|
||||
remote
|
||||
.push(&[branch], Some(&mut push_options))
|
||||
.with_context(|| {
|
||||
format!("failed to push {:?} to {:?}", branch, branch_remote_name)
|
||||
})?;
|
||||
}
|
||||
tracing::info!(
|
||||
"{}: created commit {} with message {}",
|
||||
self.project.id,
|
||||
commit_oid,
|
||||
message
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ pub async fn accept_connection(app: app::App, stream: net::TcpStream) -> Result<
|
||||
match pty_reader.read(tail) {
|
||||
Ok(0) => {
|
||||
// EOF
|
||||
tracing::info!("0 bytes read from pty. EOF.");
|
||||
tracing::debug!("0 bytes read from pty. EOF.");
|
||||
if let Err(e) = ws_sender
|
||||
.send(tokio_tungstenite::tungstenite::Message::Close(None))
|
||||
.await
|
||||
@ -153,7 +153,7 @@ pub async fn accept_connection(app: app::App, stream: net::TcpStream) -> Result<
|
||||
}
|
||||
}
|
||||
|
||||
tracing::info!("PTY child process killed.");
|
||||
tracing::debug!("PTY child process killed.");
|
||||
});
|
||||
});
|
||||
|
||||
@ -180,9 +180,9 @@ pub async fn accept_connection(app: app::App, stream: net::TcpStream) -> Result<
|
||||
}
|
||||
}
|
||||
Ok(tokio_tungstenite::tungstenite::Message::Close(_)) => {
|
||||
tracing::info!("Closing the websocket connection...");
|
||||
tracing::debug!("Closing the websocket connection...");
|
||||
|
||||
tracing::info!("Killing PTY child process...");
|
||||
tracing::debug!("Killing PTY child process...");
|
||||
pty_child_process
|
||||
.kill()
|
||||
.with_context(|| "failed to kill pty child process".to_string())?;
|
||||
|
@ -24,7 +24,7 @@ impl<'writer> PtyWriter<'writer> {
|
||||
[record],
|
||||
)?;
|
||||
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"{}: appended pty record to session",
|
||||
self.repository.project_id
|
||||
);
|
||||
|
@ -243,7 +243,7 @@ impl SearcherInner {
|
||||
writer.commit()?;
|
||||
self.reader.reload()?;
|
||||
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"{}: bookmark {} added to search",
|
||||
bookmark.project_id,
|
||||
bookmark.timestamp_ms
|
||||
@ -281,7 +281,7 @@ impl SearcherInner {
|
||||
self.meta_storage
|
||||
.set(repository.get_project_id(), &session.id, index::VERSION)?;
|
||||
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"{}: session added to search {}",
|
||||
repository.get_project_id(),
|
||||
session.id,
|
||||
|
@ -7,7 +7,7 @@ use crate::{error::Error, git};
|
||||
use super::controller::Controller;
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "commit_virtual_branch", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
pub async fn commit_virtual_branch(
|
||||
handle: AppHandle,
|
||||
project_id: &str,
|
||||
@ -22,7 +22,7 @@ pub async fn commit_virtual_branch(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "list_virtual_branches", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
pub async fn list_virtual_branches(
|
||||
handle: AppHandle,
|
||||
project_id: &str,
|
||||
@ -35,7 +35,7 @@ pub async fn list_virtual_branches(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "create_virtual_branch", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
pub async fn create_virtual_branch(
|
||||
handle: AppHandle,
|
||||
project_id: &str,
|
||||
@ -49,7 +49,7 @@ pub async fn create_virtual_branch(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "create_virtual_branch_from_branch", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
pub async fn create_virtual_branch_from_branch(
|
||||
handle: AppHandle,
|
||||
project_id: &str,
|
||||
@ -63,7 +63,7 @@ pub async fn create_virtual_branch_from_branch(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "get_base_branch_data", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
pub async fn get_base_branch_data(
|
||||
handle: AppHandle,
|
||||
project_id: &str,
|
||||
@ -76,7 +76,7 @@ pub async fn get_base_branch_data(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "set_base_branch", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
pub async fn set_base_branch(
|
||||
handle: AppHandle,
|
||||
project_id: &str,
|
||||
@ -93,7 +93,7 @@ pub async fn set_base_branch(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "update_base_branch", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
pub async fn update_base_branch(handle: AppHandle, project_id: &str) -> Result<(), Error> {
|
||||
handle
|
||||
.state::<Controller>()
|
||||
@ -103,7 +103,7 @@ pub async fn update_base_branch(handle: AppHandle, project_id: &str) -> Result<(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "update_virtual_branch", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
pub async fn update_virtual_branch(
|
||||
handle: AppHandle,
|
||||
project_id: &str,
|
||||
@ -117,7 +117,7 @@ pub async fn update_virtual_branch(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "delete_virtual_branch", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
pub async fn delete_virtual_branch(
|
||||
handle: AppHandle,
|
||||
project_id: &str,
|
||||
@ -131,7 +131,7 @@ pub async fn delete_virtual_branch(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "apply_branch", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
pub async fn apply_branch(handle: AppHandle, project_id: &str, branch: &str) -> Result<(), Error> {
|
||||
handle
|
||||
.state::<Controller>()
|
||||
@ -141,7 +141,7 @@ pub async fn apply_branch(handle: AppHandle, project_id: &str, branch: &str) ->
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "unapply_branch", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
pub async fn unapply_branch(
|
||||
handle: AppHandle,
|
||||
project_id: &str,
|
||||
@ -155,7 +155,7 @@ pub async fn unapply_branch(
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(name = "push_virtual_branch", skip(handle))]
|
||||
#[instrument(skip(handle))]
|
||||
pub async fn push_virtual_branch(
|
||||
handle: AppHandle,
|
||||
project_id: &str,
|
||||
|
@ -36,25 +36,31 @@ impl Dispatcher {
|
||||
|
||||
let (notify_tx, mut notify_rx) = channel(1);
|
||||
let mut watcher = RecommendedWatcher::new(
|
||||
move |res: notify::Result<notify::Event>| match res {
|
||||
Ok(event) => {
|
||||
if !is_interesting_kind(&event.kind) {
|
||||
return;
|
||||
}
|
||||
for path in event
|
||||
.paths
|
||||
.into_iter()
|
||||
.filter(|file| is_interesting_file(&repo, file))
|
||||
{
|
||||
block_on(async {
|
||||
tracing::warn!("detected file change event: {}", path.display());
|
||||
if let Err(error) = notify_tx.send(path).await {
|
||||
tracing::error!("failed to send file change event: {:#}", error);
|
||||
}
|
||||
});
|
||||
{
|
||||
let project_id = project_id.to_string();
|
||||
move |res: notify::Result<notify::Event>| match res {
|
||||
Ok(event) => {
|
||||
if !is_interesting_kind(&event.kind) {
|
||||
return;
|
||||
}
|
||||
for path in event
|
||||
.paths
|
||||
.into_iter()
|
||||
.filter(|file| is_interesting_file(&repo, file))
|
||||
{
|
||||
block_on(async {
|
||||
tracing::info!("{}: file change detected: {}", project_id, path.display());
|
||||
if let Err(error) = notify_tx.send(path).await {
|
||||
tracing::error!(
|
||||
"failed to send file change event: {:#}",
|
||||
error
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Err(error) => tracing::error!("file watcher error: {:#}", error),
|
||||
}
|
||||
Err(error) => tracing::error!("file watcher error: {:#}", error),
|
||||
},
|
||||
Config::default(),
|
||||
)?;
|
||||
@ -64,7 +70,7 @@ impl Dispatcher {
|
||||
.with_context(|| format!("failed to watch project path: {}", path.display()))?;
|
||||
self.watcher.lock().unwrap().replace(watcher);
|
||||
|
||||
tracing::info!("{}: file watcher started", project_id);
|
||||
tracing::debug!("{}: file watcher started", project_id);
|
||||
|
||||
let (tx, rx) = channel(1);
|
||||
let project_id = project_id.to_string();
|
||||
@ -104,7 +110,7 @@ impl Dispatcher {
|
||||
}
|
||||
}
|
||||
}
|
||||
tracing::info!("{}: file watcher stopped", project_id);
|
||||
tracing::debug!("{}: file watcher stopped", project_id);
|
||||
}
|
||||
})?;
|
||||
|
||||
|
@ -80,7 +80,7 @@ impl Dispatcher {
|
||||
}
|
||||
}
|
||||
}
|
||||
tracing::info!("{}: dispatcher stopped", project_id);
|
||||
tracing::debug!("{}: dispatcher stopped", project_id);
|
||||
})?;
|
||||
|
||||
Ok(rx)
|
||||
|
@ -39,7 +39,7 @@ impl Dispatcher {
|
||||
.spawn({
|
||||
let project_id = project_id.to_string();
|
||||
async move {
|
||||
tracing::info!("{}: ticker started", project_id);
|
||||
tracing::debug!("{}: ticker started", project_id);
|
||||
loop {
|
||||
ticker.tick().await;
|
||||
if self.cancellation_token.is_cancelled() {
|
||||
@ -55,7 +55,7 @@ impl Dispatcher {
|
||||
tracing::error!("{}: failed to send tick: {}", project_id, e);
|
||||
}
|
||||
}
|
||||
tracing::info!("{}: ticker stopped", project_id);
|
||||
tracing::debug!("{}: ticker stopped", project_id);
|
||||
}
|
||||
})?;
|
||||
|
||||
|
@ -39,20 +39,13 @@ impl Handler {
|
||||
.with_context(|| "failed to open project repository for project")?;
|
||||
|
||||
match path.as_ref().to_str().unwrap() {
|
||||
"FETCH_HEAD" => {
|
||||
tracing::info!("{}: git fetch", project.id);
|
||||
Ok(vec![events::Event::Emit(app_events::Event::git_fetch(
|
||||
&project.id,
|
||||
))])
|
||||
}
|
||||
"logs/HEAD" => {
|
||||
tracing::info!("{}: git activity", project.id);
|
||||
Ok(vec![events::Event::Emit(app_events::Event::git_activity(
|
||||
&project.id,
|
||||
))])
|
||||
}
|
||||
"FETCH_HEAD" => Ok(vec![events::Event::Emit(app_events::Event::git_fetch(
|
||||
&project.id,
|
||||
))]),
|
||||
"logs/HEAD" => Ok(vec![events::Event::Emit(app_events::Event::git_activity(
|
||||
&project.id,
|
||||
))]),
|
||||
"HEAD" => {
|
||||
tracing::info!("{}: git head changed", project.id);
|
||||
let head_ref = project_repository.get_head()?;
|
||||
if let Some(head) = head_ref.name() {
|
||||
Ok(vec![events::Event::Emit(app_events::Event::git_head(
|
||||
@ -63,12 +56,9 @@ impl Handler {
|
||||
Ok(vec![])
|
||||
}
|
||||
}
|
||||
"index" => {
|
||||
tracing::info!("{}: git index changed", project.id);
|
||||
Ok(vec![events::Event::Emit(app_events::Event::git_index(
|
||||
&project.id,
|
||||
))])
|
||||
}
|
||||
"index" => Ok(vec![events::Event::Emit(app_events::Event::git_index(
|
||||
&project.id,
|
||||
))]),
|
||||
_ => Ok(vec![]),
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ impl TryFrom<&AppHandle> for Handler {
|
||||
}
|
||||
|
||||
impl Handler {
|
||||
#[instrument(name = "handle", skip(self), fields(event = %event))]
|
||||
#[instrument(skip(self), fields(event = %event), level = "debug")]
|
||||
pub fn handle(&self, event: &events::Event) -> Result<Vec<events::Event>> {
|
||||
match event {
|
||||
events::Event::ProjectFileChange(project_id, path) => self
|
||||
|
@ -50,7 +50,7 @@ impl Watchers {
|
||||
if let Err(e) = c_watcher.run(&project_path, &project_id).await {
|
||||
tracing::error!("watcher error: {:#}", e);
|
||||
}
|
||||
tracing::info!("watcher stopped");
|
||||
tracing::debug!("watcher stopped");
|
||||
})?;
|
||||
|
||||
self.watchers
|
||||
@ -188,7 +188,7 @@ impl WatcherInner {
|
||||
e
|
||||
);
|
||||
} else {
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"{}: sent response event: {}",
|
||||
project_id,
|
||||
event
|
||||
|
@ -2,7 +2,7 @@ export type { Activity } from './activities';
|
||||
|
||||
import { invoke } from '$lib/ipc';
|
||||
|
||||
export function commit(params: { projectId: string; message: string; push: boolean }) {
|
||||
export function commit(params: { projectId: string; message: string }) {
|
||||
return invoke<boolean>('git_commit', params);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user