D8088: rust-status: add missing variants to `Dispatch` enum
Closed by commit rHG61709b844420: rust-status: add missing variants to `Dispatch` enum (authored by Alphare). This revision was automatically updated to reflect the committed changes. This revision was not accepted when it landed; it landed in state "Needs Review". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D8088?vs=20186=20719 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8088/new/ REVISION DETAIL https://phab.mercurial-scm.org/D8088 AFFECTED FILES rust/hg-core/src/dirstate/status.rs CHANGE DETAILS diff --git a/rust/hg-core/src/dirstate/status.rs b/rust/hg-core/src/dirstate/status.rs --- a/rust/hg-core/src/dirstate/status.rs +++ b/rust/hg-core/src/dirstate/status.rs @@ -25,6 +25,25 @@ use std::fs::{read_dir, DirEntry}; use std::path::Path; +/// Wrong type of file from a `BadMatch` +/// Note: a lot of those don't exist on all platforms. +#[derive(Debug)] +pub enum BadType { +CharacterDevice, +BlockDevice, +FIFO, +Socket, +Directory, +Unknown, +} + +/// Was explicitly matched but cannot be found/accessed +#[derive(Debug)] +pub enum BadMatch { +OsError(i32), +BadType(BadType), +} + /// Marker enum used to dispatch new status entries into the right collections. /// Is similar to `crate::EntryState`, but represents the transient state of /// entries during the lifetime of a command. @@ -36,6 +55,16 @@ Deleted, Clean, Unknown, +Ignored, +/// Empty dispatch, the file is not worth listing +None, +/// Was explicitly matched but cannot be found/accessed +Bad(BadMatch), +Directory { +/// True if the directory used to be a file in the dmap so we can say +/// that it's been removed. +was_file: bool, +}, } type IoResult = std::io::Result; @@ -261,8 +290,9 @@ pub removed: Vec<&'a HgPath>, pub deleted: Vec<&'a HgPath>, pub clean: Vec<&'a HgPath>, -/* TODO ignored - * TODO unknown */ +pub ignored: Vec<&'a HgPath>, +pub unknown: Vec<&'a HgPath>, +pub bad: Vec<(&'a HgPath, BadMatch)>, } fn build_response<'a>( @@ -274,17 +304,24 @@ let mut removed = vec![]; let mut deleted = vec![]; let mut clean = vec![]; +let mut ignored = vec![]; +let mut unknown = vec![]; +let mut bad = vec![]; for res in results.into_iter() { let (filename, dispatch) = res?; match dispatch { -Dispatch::Unknown => {} +Dispatch::Unknown => unknown.push(filename), Dispatch::Unsure => lookup.push(filename), Dispatch::Modified => modified.push(filename), Dispatch::Added => added.push(filename), Dispatch::Removed => removed.push(filename), Dispatch::Deleted => deleted.push(filename), Dispatch::Clean => clean.push(filename), +Dispatch::Ignored => ignored.push(filename), +Dispatch::None => {} +Dispatch::Bad(reason) => bad.push((filename, reason)), +Dispatch::Directory { .. } => {} } } @@ -296,6 +333,9 @@ removed, deleted, clean, +ignored, +unknown, +bad, }, )) } To: Alphare, #hg-reviewers, kevincox, marmoute Cc: kevincox, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D8088: rust-status: add missing variants to `Dispatch` enum
Alphare updated this revision to Diff 20186. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D8088?vs=20046=20186 BRANCH default CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8088/new/ REVISION DETAIL https://phab.mercurial-scm.org/D8088 AFFECTED FILES rust/hg-core/src/dirstate/status.rs CHANGE DETAILS diff --git a/rust/hg-core/src/dirstate/status.rs b/rust/hg-core/src/dirstate/status.rs --- a/rust/hg-core/src/dirstate/status.rs +++ b/rust/hg-core/src/dirstate/status.rs @@ -25,6 +25,25 @@ use std::fs::{read_dir, DirEntry}; use std::path::Path; +/// Wrong type of file from a `BadMatch` +/// Note: a lot of those don't exist on all platforms. +#[derive(Debug)] +pub enum BadType { +CharacterDevice, +BlockDevice, +FIFO, +Socket, +Directory, +Unknown, +} + +/// Was explicitly matched but cannot be found/accessed +#[derive(Debug)] +pub enum BadMatch { +OsError(i32), +BadType(BadType), +} + /// Marker enum used to dispatch new status entries into the right collections. /// Is similar to `crate::EntryState`, but represents the transient state of /// entries during the lifetime of a command. @@ -36,6 +55,16 @@ Deleted, Clean, Unknown, +Ignored, +/// Empty dispatch, the file is not worth listing +None, +/// Was explicitly matched but cannot be found/accessed +Bad(BadMatch), +Directory { +/// True if the directory used to be a file in the dmap so we can say +/// that it's been removed. +was_file: bool, +}, } type IoResult = std::io::Result; @@ -261,8 +290,9 @@ pub removed: Vec<&'a HgPath>, pub deleted: Vec<&'a HgPath>, pub clean: Vec<&'a HgPath>, -/* TODO ignored - * TODO unknown */ +pub ignored: Vec<&'a HgPath>, +pub unknown: Vec<&'a HgPath>, +pub bad: Vec<(&'a HgPath, BadMatch)>, } fn build_response<'a>( @@ -274,17 +304,24 @@ let mut removed = vec![]; let mut deleted = vec![]; let mut clean = vec![]; +let mut ignored = vec![]; +let mut unknown = vec![]; +let mut bad = vec![]; for res in results.into_iter() { let (filename, dispatch) = res?; match dispatch { -Dispatch::Unknown => {} +Dispatch::Unknown => unknown.push(filename), Dispatch::Unsure => lookup.push(filename), Dispatch::Modified => modified.push(filename), Dispatch::Added => added.push(filename), Dispatch::Removed => removed.push(filename), Dispatch::Deleted => deleted.push(filename), Dispatch::Clean => clean.push(filename), +Dispatch::Ignored => ignored.push(filename), +Dispatch::None => {} +Dispatch::Bad(reason) => bad.push((filename, reason)), +Dispatch::Directory { .. } => {} } } @@ -296,6 +333,9 @@ removed, deleted, clean, +ignored, +unknown, +bad, }, )) } To: Alphare, #hg-reviewers, kevincox Cc: kevincox, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D8088: rust-status: add missing variants to `Dispatch` enum
Alphare updated this revision to Diff 20046. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D8088?vs=19945=20046 BRANCH default CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8088/new/ REVISION DETAIL https://phab.mercurial-scm.org/D8088 AFFECTED FILES rust/hg-core/src/dirstate/status.rs CHANGE DETAILS diff --git a/rust/hg-core/src/dirstate/status.rs b/rust/hg-core/src/dirstate/status.rs --- a/rust/hg-core/src/dirstate/status.rs +++ b/rust/hg-core/src/dirstate/status.rs @@ -25,6 +25,25 @@ use std::fs::{read_dir, DirEntry}; use std::path::Path; +/// Wrong type of file from a `BadMatch` +/// Note: a lot of those don't exist on all platforms. +#[derive(Debug)] +pub enum BadType { +CharacterDevice, +BlockDevice, +FIFO, +Socket, +Directory, +Unknown, +} + +/// Was explicitly matched but cannot be found/accessed +#[derive(Debug)] +pub enum BadMatch { +OsError(i32), +BadType(BadType), +} + /// Marker enum used to dispatch new status entries into the right collections. /// Is similar to `crate::EntryState`, but represents the transient state of /// entries during the lifetime of a command. @@ -36,6 +55,11 @@ Deleted, Clean, Unknown, +Ignored, +/// Empty dispatch, the file is not worth listing +None, +/// Was explicitly matched but cannot be found/accessed +Bad(BadMatch), } type IoResult = std::io::Result; @@ -261,8 +285,9 @@ pub removed: Vec<&'a HgPath>, pub deleted: Vec<&'a HgPath>, pub clean: Vec<&'a HgPath>, -/* TODO ignored - * TODO unknown */ +pub ignored: Vec<&'a HgPath>, +pub unknown: Vec<&'a HgPath>, +pub bad: Vec<(&'a HgPath, BadMatch)>, } fn build_response<'a>( @@ -274,17 +299,23 @@ let mut removed = vec![]; let mut deleted = vec![]; let mut clean = vec![]; +let mut ignored = vec![]; +let mut unknown = vec![]; +let mut bad = vec![]; for res in results.into_iter() { let (filename, dispatch) = res?; match dispatch { -Dispatch::Unknown => {} +Dispatch::Unknown => unknown.push(filename), Dispatch::Unsure => lookup.push(filename), Dispatch::Modified => modified.push(filename), Dispatch::Added => added.push(filename), Dispatch::Removed => removed.push(filename), Dispatch::Deleted => deleted.push(filename), Dispatch::Clean => clean.push(filename), +Dispatch::Ignored => ignored.push(filename), +Dispatch::None => {} +Dispatch::Bad(reason) => bad.push((filename, reason)), } } @@ -296,6 +327,9 @@ removed, deleted, clean, +ignored, +unknown, +bad, }, )) } To: Alphare, #hg-reviewers, kevincox Cc: kevincox, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D8088: rust-status: add missing variants to `Dispatch` enum
kevincox added inline comments. kevincox accepted this revision. INLINE COMMENTS > status.rs:288 > /* TODO ignored > * TODO unknown */ > } TODO is done. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8088/new/ REVISION DETAIL https://phab.mercurial-scm.org/D8088 To: Alphare, #hg-reviewers, kevincox Cc: kevincox, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D8088: rust-status: add missing variants to `Dispatch` enum
Alphare created this revision. Herald added subscribers: mercurial-devel, kevincox. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D8088 AFFECTED FILES rust/hg-core/src/dirstate/status.rs CHANGE DETAILS diff --git a/rust/hg-core/src/dirstate/status.rs b/rust/hg-core/src/dirstate/status.rs --- a/rust/hg-core/src/dirstate/status.rs +++ b/rust/hg-core/src/dirstate/status.rs @@ -25,6 +25,25 @@ use std::fs::{read_dir, DirEntry}; use std::path::Path; +/// Wrong type of file from a `BadMatch` +/// Note: a lot of those don't exist on all platforms. +#[derive(Debug)] +pub enum BadType { +CharacterDevice, +BlockDevice, +FIFO, +Socket, +Directory, +Unknown, +} + +/// Was explicitly matched but cannot be found/accessed +#[derive(Debug)] +pub enum BadMatch { +OsError(i32), +BadType(BadType), +} + /// Marker enum used to dispatch new status entries into the right collections. /// Is similar to `crate::EntryState`, but represents the transient state of /// entries during the lifetime of a command. @@ -36,6 +55,11 @@ Deleted, Clean, Unknown, +Ignored, +/// Empty dispatch, the file is not worth listing +None, +/// Was explicitly matched but cannot be found/accessed +Bad(BadMatch), } type IoResult = std::io::Result; @@ -257,6 +281,9 @@ pub removed: Vec<&'a HgPath>, pub deleted: Vec<&'a HgPath>, pub clean: Vec<&'a HgPath>, +pub ignored: Vec<&'a HgPath>, +pub unknown: Vec<&'a HgPath>, +pub bad: Vec<(&'a HgPath, BadMatch)>, /* TODO ignored * TODO unknown */ } @@ -270,17 +297,23 @@ let mut removed = vec![]; let mut deleted = vec![]; let mut clean = vec![]; +let mut ignored = vec![]; +let mut unknown = vec![]; +let mut bad = vec![]; for res in results.into_iter() { let (filename, dispatch) = res?; match dispatch { -Dispatch::Unknown => {} +Dispatch::Unknown => unknown.push(filename), Dispatch::Unsure => lookup.push(filename), Dispatch::Modified => modified.push(filename), Dispatch::Added => added.push(filename), Dispatch::Removed => removed.push(filename), Dispatch::Deleted => deleted.push(filename), Dispatch::Clean => clean.push(filename), +Dispatch::Ignored => ignored.push(filename), +Dispatch::None => {} +Dispatch::Bad(reason) => bad.push((filename, reason)), } } @@ -292,6 +325,9 @@ removed, deleted, clean, +ignored, +unknown, +bad, }, )) } To: Alphare, #hg-reviewers Cc: kevincox, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel