Skip to content

Commit

Permalink
Switch from a private extension to the newly release 0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fowles committed Jun 19, 2024
1 parent bbe7162 commit 95fbf9f
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 244 deletions.
53 changes: 22 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features =
] }
unicode-width = "0.1.13"
version_check = "0.9.4"
watchman_client = { version = "0.8.0" }
watchman_client = { version = "0.9.0" }
whoami = "1.5.1"
winreg = "0.52"
zstd = "0.12.4"
Expand Down
47 changes: 23 additions & 24 deletions lib/src/fsmonitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ pub mod watchman {
use tracing::{info, instrument};
use watchman_client::expr;
use watchman_client::prelude::{
Clock as InnerClock, ClockSpec, NameOnly, QueryRequestCommon, QueryResult,
};

use crate::fsmonitor_watchman_extensions::{
list_triggers, register_trigger, remove_trigger, TriggerRequest,
Clock as InnerClock, ClockSpec, NameOnly, QueryRequestCommon, QueryResult, TriggerRequest,
};

/// Represents an instance in time from the perspective of the filesystem
Expand Down Expand Up @@ -266,7 +262,9 @@ pub mod watchman {
#[instrument(skip(self))]
async fn is_trigger_registered(&self) -> Result<bool, Error> {
info!("Checking for an existing Watchman trigger...");
Ok(list_triggers(&self.client, &self.resolved_root)
Ok(self
.client
.list_triggers(&self.resolved_root)
.await
.map_err(Error::WatchmanTriggerError)?
.triggers
Expand All @@ -278,31 +276,32 @@ pub mod watchman {
#[instrument(skip(self))]
async fn register_trigger(&self) -> Result<(), Error> {
info!("Registering Watchman trigger...");
register_trigger(
&self.client,
&self.resolved_root,
TriggerRequest {
name: "jj-background-monitor".to_string(),
command: vec![
"jj".to_string(),
"files".to_string(),
"-r".to_string(),
"root()".to_string(),
],
expression: Some(self.build_exclude_expr()),
..Default::default()
},
)
.await
.map_err(Error::WatchmanTriggerError)?;
self.client
.register_trigger(
&self.resolved_root,
TriggerRequest {
name: "jj-background-monitor".to_string(),
command: vec![
"jj".to_string(),
"files".to_string(),
"-r".to_string(),
"root()".to_string(),
],
expression: Some(self.build_exclude_expr()),
..Default::default()
},
)
.await
.map_err(Error::WatchmanTriggerError)?;
Ok(())
}

/// Register trigger for changed files.
#[instrument(skip(self))]
async fn unregister_trigger(&self) -> Result<(), Error> {
info!("Unregistering Watchman trigger...");
remove_trigger(&self.client, &self.resolved_root, "jj-background-monitor")
self.client
.remove_trigger(&self.resolved_root, "jj-background-monitor")
.await
.map_err(Error::WatchmanTriggerError)?;
Ok(())
Expand Down
186 changes: 0 additions & 186 deletions lib/src/fsmonitor_watchman_extensions.rs

This file was deleted.

Loading

0 comments on commit 95fbf9f

Please sign in to comment.