rust/hg-core/src/dirstate/status.rs
changeset 48454 473af5cbc209
parent 48422 000130cfafb6
child 48501 4afb9627dc77
equal deleted inserted replaced
48453:9b0e1f64656f 48454:473af5cbc209
    64     /// Whether we are on a filesystem with UNIX-like exec flags
    64     /// Whether we are on a filesystem with UNIX-like exec flags
    65     pub check_exec: bool,
    65     pub check_exec: bool,
    66     pub list_clean: bool,
    66     pub list_clean: bool,
    67     pub list_unknown: bool,
    67     pub list_unknown: bool,
    68     pub list_ignored: bool,
    68     pub list_ignored: bool,
       
    69     /// Whether to populate `StatusPath::copy_source`
       
    70     pub list_copies: bool,
    69     /// Whether to collect traversed dirs for applying a callback later.
    71     /// Whether to collect traversed dirs for applying a callback later.
    70     /// Used by `hg purge` for example.
    72     /// Used by `hg purge` for example.
    71     pub collect_traversed_dirs: bool,
    73     pub collect_traversed_dirs: bool,
    72 }
    74 }
    73 
    75 
    74 #[derive(Debug, Default)]
    76 #[derive(Default)]
    75 pub struct DirstateStatus<'a> {
    77 pub struct DirstateStatus<'a> {
    76     /// The current time at the start of the `status()` algorithm, as measured
    78     /// The current time at the start of the `status()` algorithm, as measured
    77     /// and possibly truncated by the filesystem.
    79     /// and possibly truncated by the filesystem.
    78     pub filesystem_time_at_status_start: Option<std::time::SystemTime>,
    80     pub filesystem_time_at_status_start: Option<std::time::SystemTime>,
    79 
    81 
    80     /// Tracked files whose contents have changed since the parent revision
    82     /// Tracked files whose contents have changed since the parent revision
    81     pub modified: Vec<HgPathCow<'a>>,
    83     pub modified: Vec<StatusPath<'a>>,
    82 
    84 
    83     /// Newly-tracked files that were not present in the parent
    85     /// Newly-tracked files that were not present in the parent
    84     pub added: Vec<HgPathCow<'a>>,
    86     pub added: Vec<StatusPath<'a>>,
    85 
    87 
    86     /// Previously-tracked files that have been (re)moved with an hg command
    88     /// Previously-tracked files that have been (re)moved with an hg command
    87     pub removed: Vec<HgPathCow<'a>>,
    89     pub removed: Vec<StatusPath<'a>>,
    88 
    90 
    89     /// (Still) tracked files that are missing, (re)moved with an non-hg
    91     /// (Still) tracked files that are missing, (re)moved with an non-hg
    90     /// command
    92     /// command
    91     pub deleted: Vec<HgPathCow<'a>>,
    93     pub deleted: Vec<StatusPath<'a>>,
    92 
    94 
    93     /// Tracked files that are up to date with the parent.
    95     /// Tracked files that are up to date with the parent.
    94     /// Only pupulated if `StatusOptions::list_clean` is true.
    96     /// Only pupulated if `StatusOptions::list_clean` is true.
    95     pub clean: Vec<HgPathCow<'a>>,
    97     pub clean: Vec<StatusPath<'a>>,
    96 
    98 
    97     /// Files in the working directory that are ignored with `.hgignore`.
    99     /// Files in the working directory that are ignored with `.hgignore`.
    98     /// Only pupulated if `StatusOptions::list_ignored` is true.
   100     /// Only pupulated if `StatusOptions::list_ignored` is true.
    99     pub ignored: Vec<HgPathCow<'a>>,
   101     pub ignored: Vec<StatusPath<'a>>,
   100 
   102 
   101     /// Files in the working directory that are neither tracked nor ignored.
   103     /// Files in the working directory that are neither tracked nor ignored.
   102     /// Only pupulated if `StatusOptions::list_unknown` is true.
   104     /// Only pupulated if `StatusOptions::list_unknown` is true.
   103     pub unknown: Vec<HgPathCow<'a>>,
   105     pub unknown: Vec<StatusPath<'a>>,
   104 
   106 
   105     /// Was explicitly matched but cannot be found/accessed
   107     /// Was explicitly matched but cannot be found/accessed
   106     pub bad: Vec<(HgPathCow<'a>, BadMatch)>,
   108     pub bad: Vec<(HgPathCow<'a>, BadMatch)>,
   107 
   109 
   108     /// Either clean or modified, but we can’t tell from filesystem metadata
   110     /// Either clean or modified, but we can’t tell from filesystem metadata
   109     /// alone. The file contents need to be read and compared with that in
   111     /// alone. The file contents need to be read and compared with that in
   110     /// the parent.
   112     /// the parent.
   111     pub unsure: Vec<HgPathCow<'a>>,
   113     pub unsure: Vec<StatusPath<'a>>,
   112 
   114 
   113     /// Only filled if `collect_traversed_dirs` is `true`
   115     /// Only filled if `collect_traversed_dirs` is `true`
   114     pub traversed: Vec<HgPathCow<'a>>,
   116     pub traversed: Vec<HgPathCow<'a>>,
   115 
   117 
   116     /// Whether `status()` made changed to the `DirstateMap` that should be
   118     /// Whether `status()` made changed to the `DirstateMap` that should be
   117     /// written back to disk
   119     /// written back to disk
   118     pub dirty: bool,
   120     pub dirty: bool,
       
   121 }
       
   122 
       
   123 #[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
       
   124 pub struct StatusPath<'a> {
       
   125     pub path: HgPathCow<'a>,
       
   126     pub copy_source: Option<HgPathCow<'a>>,
   119 }
   127 }
   120 
   128 
   121 #[derive(Debug, derive_more::From)]
   129 #[derive(Debug, derive_more::From)]
   122 pub enum StatusError {
   130 pub enum StatusError {
   123     /// Generic IO error
   131     /// Generic IO error