rust/rhg/src/commands/status.rs
author Arseniy Alekseyev <aalekseyev@janestreet.com>
Tue, 16 Nov 2021 11:53:58 +0000
changeset 48409 005ae1a343f8
parent 48391 b80e5e75d51e
child 48422 000130cfafb6
permissions -rw-r--r--
rhg: add support for narrow clones and sparse checkouts This adds a minimal support that can be implemented without parsing the narrowspec. We can parse the narrowspec and add support for more operations later. The reason we need so few code changes is as follows: Most operations need no special treatment of sparse because some of them only read dirstate (`rhg files` without `-r`), which bakes in the filtering, some of them only read store (`rhg files -r`, `rhg cat`), and some of them read no data at all (`rhg root`, `rhg debugrequirements`). `status` is the command that might care about sparse, so we just disable rhg on it. For narrow clones, `rhg files` clearly needs the narrowspec to work correctly, so we fall back. `rhg cat` seems to work consistently with `hg cat` if the file exists. If the file is hidden by narrow spec, the error message is different and confusing, so that's something that we should improve in follow-up patches. Differential Revision: https://phab.mercurial-scm.org/D11764
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
     1
// status.rs
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
     2
//
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
     3
// Copyright 2020, Georges Racinet <georges.racinets@octobus.net>
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
     4
//
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
     5
// This software may be used and distributed according to the terms of the
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
     6
// GNU General Public License version 2 or any later version.
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
     7
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
     8
use crate::error::CommandError;
48349
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
     9
use crate::ui::Ui;
48175
707c58880cd0 rhg: add relative paths support in `rhg status`
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48171
diff changeset
    10
use crate::utils::path_utils::relativize_paths;
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    11
use clap::{Arg, SubCommand};
48349
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
    12
use format_bytes::format_bytes;
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    13
use hg;
48175
707c58880cd0 rhg: add relative paths support in `rhg status`
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48171
diff changeset
    14
use hg::config::Config;
48391
b80e5e75d51e dirstate: remove `lastnormaltime` mechanism
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48349
diff changeset
    15
use hg::dirstate::has_exec_bit;
47965
f9e6f2bb721d rhg: Don’t compare ambiguous files one byte at a time
Simon Sapin <simon.sapin@octobus.net>
parents: 47964
diff changeset
    16
use hg::errors::HgError;
47964
796206e74b10 rhg: Reuse manifest when checking status of multiple ambiguous files
Simon Sapin <simon.sapin@octobus.net>
parents: 47956
diff changeset
    17
use hg::manifest::Manifest;
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    18
use hg::matchers::AlwaysMatcher;
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    19
use hg::repo::Repo;
48345
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
    20
use hg::utils::files::get_bytes_from_os_string;
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    21
use hg::utils::hg_path::{hg_path_to_os_string, HgPath};
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    22
use hg::{HgPathCow, StatusOptions};
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    23
use log::{info, warn};
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    24
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    25
pub const HELP_TEXT: &str = "
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    26
Show changed files in the working directory
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    27
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    28
This is a pure Rust version of `hg status`.
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    29
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    30
Some options might be missing, check the list below.
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    31
";
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    32
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    33
pub fn args() -> clap::App<'static, 'static> {
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    34
    SubCommand::with_name("status")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    35
        .alias("st")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    36
        .about(HELP_TEXT)
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    37
        .arg(
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    38
            Arg::with_name("all")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    39
                .help("show status of all files")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    40
                .short("-A")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    41
                .long("--all"),
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    42
        )
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    43
        .arg(
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    44
            Arg::with_name("modified")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    45
                .help("show only modified files")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    46
                .short("-m")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    47
                .long("--modified"),
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    48
        )
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    49
        .arg(
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    50
            Arg::with_name("added")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    51
                .help("show only added files")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    52
                .short("-a")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    53
                .long("--added"),
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    54
        )
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    55
        .arg(
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    56
            Arg::with_name("removed")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    57
                .help("show only removed files")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    58
                .short("-r")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    59
                .long("--removed"),
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    60
        )
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    61
        .arg(
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    62
            Arg::with_name("clean")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    63
                .help("show only clean files")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    64
                .short("-c")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    65
                .long("--clean"),
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    66
        )
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    67
        .arg(
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    68
            Arg::with_name("deleted")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    69
                .help("show only deleted files")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    70
                .short("-d")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    71
                .long("--deleted"),
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    72
        )
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    73
        .arg(
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    74
            Arg::with_name("unknown")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    75
                .help("show only unknown (not tracked) files")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    76
                .short("-u")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    77
                .long("--unknown"),
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    78
        )
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    79
        .arg(
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    80
            Arg::with_name("ignored")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    81
                .help("show only ignored files")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    82
                .short("-i")
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    83
                .long("--ignored"),
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    84
        )
48349
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
    85
        .arg(
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
    86
            Arg::with_name("no-status")
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
    87
                .help("hide status prefix")
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
    88
                .short("-n")
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
    89
                .long("--no-status"),
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
    90
        )
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    91
}
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    92
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    93
/// Pure data type allowing the caller to specify file states to display
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    94
#[derive(Copy, Clone, Debug)]
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    95
pub struct DisplayStates {
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    96
    pub modified: bool,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    97
    pub added: bool,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    98
    pub removed: bool,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
    99
    pub clean: bool,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   100
    pub deleted: bool,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   101
    pub unknown: bool,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   102
    pub ignored: bool,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   103
}
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   104
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   105
pub const DEFAULT_DISPLAY_STATES: DisplayStates = DisplayStates {
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   106
    modified: true,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   107
    added: true,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   108
    removed: true,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   109
    clean: false,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   110
    deleted: true,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   111
    unknown: true,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   112
    ignored: false,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   113
};
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   114
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   115
pub const ALL_DISPLAY_STATES: DisplayStates = DisplayStates {
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   116
    modified: true,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   117
    added: true,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   118
    removed: true,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   119
    clean: true,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   120
    deleted: true,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   121
    unknown: true,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   122
    ignored: true,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   123
};
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   124
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   125
impl DisplayStates {
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   126
    pub fn is_empty(&self) -> bool {
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   127
        !(self.modified
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   128
            || self.added
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   129
            || self.removed
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   130
            || self.clean
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   131
            || self.deleted
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   132
            || self.unknown
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   133
            || self.ignored)
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   134
    }
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   135
}
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   136
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   137
pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> {
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   138
    let status_enabled_default = false;
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   139
    let status_enabled = invocation.config.get_option(b"rhg", b"status")?;
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   140
    if !status_enabled.unwrap_or(status_enabled_default) {
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   141
        return Err(CommandError::unsupported(
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   142
            "status is experimental in rhg (enable it with 'rhg.status = true' \
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   143
            or enable fallback with 'rhg.on-unsupported = fallback')"
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   144
        ));
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   145
    }
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   146
48171
64b8676f11bb rhg: fallback if tweakdefaults or statuscopies is enabled with status
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48069
diff changeset
   147
    // TODO: lift these limitations
48337
3bd62274cbc9 rhg: Propagate config errors in `rhg status`
Simon Sapin <simon.sapin@octobus.net>
parents: 48309
diff changeset
   148
    if invocation.config.get_bool(b"ui", b"tweakdefaults")? {
48171
64b8676f11bb rhg: fallback if tweakdefaults or statuscopies is enabled with status
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48069
diff changeset
   149
        return Err(CommandError::unsupported(
64b8676f11bb rhg: fallback if tweakdefaults or statuscopies is enabled with status
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48069
diff changeset
   150
            "ui.tweakdefaults is not yet supported with rhg status",
64b8676f11bb rhg: fallback if tweakdefaults or statuscopies is enabled with status
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48069
diff changeset
   151
        ));
64b8676f11bb rhg: fallback if tweakdefaults or statuscopies is enabled with status
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48069
diff changeset
   152
    }
48337
3bd62274cbc9 rhg: Propagate config errors in `rhg status`
Simon Sapin <simon.sapin@octobus.net>
parents: 48309
diff changeset
   153
    if invocation.config.get_bool(b"ui", b"statuscopies")? {
48171
64b8676f11bb rhg: fallback if tweakdefaults or statuscopies is enabled with status
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48069
diff changeset
   154
        return Err(CommandError::unsupported(
64b8676f11bb rhg: fallback if tweakdefaults or statuscopies is enabled with status
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48069
diff changeset
   155
            "ui.statuscopies is not yet supported with rhg status",
64b8676f11bb rhg: fallback if tweakdefaults or statuscopies is enabled with status
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48069
diff changeset
   156
        ));
64b8676f11bb rhg: fallback if tweakdefaults or statuscopies is enabled with status
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48069
diff changeset
   157
    }
48338
f9db8eeb3aec rhg: Config commands.status.terse is not supported
Simon Sapin <simon.sapin@octobus.net>
parents: 48337
diff changeset
   158
    if invocation
f9db8eeb3aec rhg: Config commands.status.terse is not supported
Simon Sapin <simon.sapin@octobus.net>
parents: 48337
diff changeset
   159
        .config
f9db8eeb3aec rhg: Config commands.status.terse is not supported
Simon Sapin <simon.sapin@octobus.net>
parents: 48337
diff changeset
   160
        .get(b"commands", b"status.terse")
f9db8eeb3aec rhg: Config commands.status.terse is not supported
Simon Sapin <simon.sapin@octobus.net>
parents: 48337
diff changeset
   161
        .is_some()
f9db8eeb3aec rhg: Config commands.status.terse is not supported
Simon Sapin <simon.sapin@octobus.net>
parents: 48337
diff changeset
   162
    {
f9db8eeb3aec rhg: Config commands.status.terse is not supported
Simon Sapin <simon.sapin@octobus.net>
parents: 48337
diff changeset
   163
        return Err(CommandError::unsupported(
f9db8eeb3aec rhg: Config commands.status.terse is not supported
Simon Sapin <simon.sapin@octobus.net>
parents: 48337
diff changeset
   164
            "status.terse is not yet supported with rhg status",
f9db8eeb3aec rhg: Config commands.status.terse is not supported
Simon Sapin <simon.sapin@octobus.net>
parents: 48337
diff changeset
   165
        ));
f9db8eeb3aec rhg: Config commands.status.terse is not supported
Simon Sapin <simon.sapin@octobus.net>
parents: 48337
diff changeset
   166
    }
48171
64b8676f11bb rhg: fallback if tweakdefaults or statuscopies is enabled with status
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48069
diff changeset
   167
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   168
    let ui = invocation.ui;
48175
707c58880cd0 rhg: add relative paths support in `rhg status`
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48171
diff changeset
   169
    let config = invocation.config;
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   170
    let args = invocation.subcommand_args;
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   171
    let display_states = if args.is_present("all") {
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   172
        // TODO when implementing `--quiet`: it excludes clean files
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   173
        // from `--all`
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   174
        ALL_DISPLAY_STATES
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   175
    } else {
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   176
        let requested = DisplayStates {
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   177
            modified: args.is_present("modified"),
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   178
            added: args.is_present("added"),
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   179
            removed: args.is_present("removed"),
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   180
            clean: args.is_present("clean"),
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   181
            deleted: args.is_present("deleted"),
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   182
            unknown: args.is_present("unknown"),
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   183
            ignored: args.is_present("ignored"),
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   184
        };
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   185
        if requested.is_empty() {
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   186
            DEFAULT_DISPLAY_STATES
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   187
        } else {
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   188
            requested
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   189
        }
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   190
    };
48349
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   191
    let no_status = args.is_present("no-status");
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   192
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   193
    let repo = invocation.repo?;
48409
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48391
diff changeset
   194
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48391
diff changeset
   195
    if repo.has_sparse() || repo.has_narrow() {
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48391
diff changeset
   196
        return Err(CommandError::unsupported(
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48391
diff changeset
   197
            "rhg status is not supported for sparse checkouts or narrow clones yet"
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48391
diff changeset
   198
        ));
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48391
diff changeset
   199
    }
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48391
diff changeset
   200
47956
81aedf1fc897 rust: Add Repo::dirstate_map and use it in `rhg status`
Simon Sapin <simon.sapin@octobus.net>
parents: 47682
diff changeset
   201
    let mut dmap = repo.dirstate_map_mut()?;
47674
ff97e793ed36 dirstate-v2: Introduce a docket file
Simon Sapin <simon.sapin@octobus.net>
parents: 47374
diff changeset
   202
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   203
    let options = StatusOptions {
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   204
        // we're currently supporting file systems with exec flags only
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   205
        // anyway
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   206
        check_exec: true,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   207
        list_clean: display_states.clean,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   208
        list_unknown: display_states.unknown,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   209
        list_ignored: display_states.ignored,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   210
        collect_traversed_dirs: false,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   211
    };
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   212
    let ignore_file = repo.working_directory_vfs().join(".hgignore"); // TODO hardcoded
47956
81aedf1fc897 rust: Add Repo::dirstate_map and use it in `rhg status`
Simon Sapin <simon.sapin@octobus.net>
parents: 47682
diff changeset
   213
    let (mut ds_status, pattern_warnings) = dmap.status(
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   214
        &AlwaysMatcher,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   215
        repo.working_directory_path().to_owned(),
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   216
        vec![ignore_file],
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   217
        options,
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   218
    )?;
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   219
    if !pattern_warnings.is_empty() {
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   220
        warn!("Pattern warnings: {:?}", &pattern_warnings);
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   221
    }
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   222
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   223
    if !ds_status.bad.is_empty() {
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   224
        warn!("Bad matches {:?}", &(ds_status.bad))
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   225
    }
47110
9c6b458a08e1 rust: Move "lookup" a.k.a. "unsure" paths into `DirstateStatus` struct
Simon Sapin <simon.sapin@octobus.net>
parents: 46822
diff changeset
   226
    if !ds_status.unsure.is_empty() {
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   227
        info!(
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   228
            "Files to be rechecked by retrieval from filelog: {:?}",
47110
9c6b458a08e1 rust: Move "lookup" a.k.a. "unsure" paths into `DirstateStatus` struct
Simon Sapin <simon.sapin@octobus.net>
parents: 46822
diff changeset
   229
            &ds_status.unsure
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   230
        );
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   231
    }
47321
62225f9da938 rhg: Sort `rhg status` output correctly
Simon Sapin <simon.sapin@octobus.net>
parents: 47110
diff changeset
   232
    if !ds_status.unsure.is_empty()
62225f9da938 rhg: Sort `rhg status` output correctly
Simon Sapin <simon.sapin@octobus.net>
parents: 47110
diff changeset
   233
        && (display_states.modified || display_states.clean)
62225f9da938 rhg: Sort `rhg status` output correctly
Simon Sapin <simon.sapin@octobus.net>
parents: 47110
diff changeset
   234
    {
47964
796206e74b10 rhg: Reuse manifest when checking status of multiple ambiguous files
Simon Sapin <simon.sapin@octobus.net>
parents: 47956
diff changeset
   235
        let p1 = repo.dirstate_parents()?.p1;
796206e74b10 rhg: Reuse manifest when checking status of multiple ambiguous files
Simon Sapin <simon.sapin@octobus.net>
parents: 47956
diff changeset
   236
        let manifest = repo.manifest_for_node(p1).map_err(|e| {
796206e74b10 rhg: Reuse manifest when checking status of multiple ambiguous files
Simon Sapin <simon.sapin@octobus.net>
parents: 47956
diff changeset
   237
            CommandError::from((e, &*format!("{:x}", p1.short())))
796206e74b10 rhg: Reuse manifest when checking status of multiple ambiguous files
Simon Sapin <simon.sapin@octobus.net>
parents: 47956
diff changeset
   238
        })?;
47110
9c6b458a08e1 rust: Move "lookup" a.k.a. "unsure" paths into `DirstateStatus` struct
Simon Sapin <simon.sapin@octobus.net>
parents: 46822
diff changeset
   239
        for to_check in ds_status.unsure {
48344
b6d8eea9872c rhg: Rename cat_file_is_modified
Simon Sapin <simon.sapin@octobus.net>
parents: 48343
diff changeset
   240
            if unsure_is_modified(repo, &manifest, &to_check)? {
47321
62225f9da938 rhg: Sort `rhg status` output correctly
Simon Sapin <simon.sapin@octobus.net>
parents: 47110
diff changeset
   241
                if display_states.modified {
62225f9da938 rhg: Sort `rhg status` output correctly
Simon Sapin <simon.sapin@octobus.net>
parents: 47110
diff changeset
   242
                    ds_status.modified.push(to_check);
62225f9da938 rhg: Sort `rhg status` output correctly
Simon Sapin <simon.sapin@octobus.net>
parents: 47110
diff changeset
   243
                }
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   244
            } else {
47321
62225f9da938 rhg: Sort `rhg status` output correctly
Simon Sapin <simon.sapin@octobus.net>
parents: 47110
diff changeset
   245
                if display_states.clean {
62225f9da938 rhg: Sort `rhg status` output correctly
Simon Sapin <simon.sapin@octobus.net>
parents: 47110
diff changeset
   246
                    ds_status.clean.push(to_check);
62225f9da938 rhg: Sort `rhg status` output correctly
Simon Sapin <simon.sapin@octobus.net>
parents: 47110
diff changeset
   247
                }
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   248
            }
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   249
        }
47321
62225f9da938 rhg: Sort `rhg status` output correctly
Simon Sapin <simon.sapin@octobus.net>
parents: 47110
diff changeset
   250
    }
62225f9da938 rhg: Sort `rhg status` output correctly
Simon Sapin <simon.sapin@octobus.net>
parents: 47110
diff changeset
   251
    if display_states.modified {
48349
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   252
        display_status_paths(
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   253
            ui,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   254
            repo,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   255
            config,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   256
            no_status,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   257
            &mut ds_status.modified,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   258
            b"M",
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   259
        )?;
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   260
    }
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   261
    if display_states.added {
48349
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   262
        display_status_paths(
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   263
            ui,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   264
            repo,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   265
            config,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   266
            no_status,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   267
            &mut ds_status.added,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   268
            b"A",
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   269
        )?;
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   270
    }
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   271
    if display_states.removed {
48349
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   272
        display_status_paths(
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   273
            ui,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   274
            repo,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   275
            config,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   276
            no_status,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   277
            &mut ds_status.removed,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   278
            b"R",
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   279
        )?;
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   280
    }
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   281
    if display_states.deleted {
48349
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   282
        display_status_paths(
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   283
            ui,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   284
            repo,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   285
            config,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   286
            no_status,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   287
            &mut ds_status.deleted,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   288
            b"!",
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   289
        )?;
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   290
    }
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   291
    if display_states.unknown {
48349
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   292
        display_status_paths(
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   293
            ui,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   294
            repo,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   295
            config,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   296
            no_status,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   297
            &mut ds_status.unknown,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   298
            b"?",
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   299
        )?;
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   300
    }
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   301
    if display_states.ignored {
48349
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   302
        display_status_paths(
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   303
            ui,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   304
            repo,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   305
            config,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   306
            no_status,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   307
            &mut ds_status.ignored,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   308
            b"I",
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   309
        )?;
47321
62225f9da938 rhg: Sort `rhg status` output correctly
Simon Sapin <simon.sapin@octobus.net>
parents: 47110
diff changeset
   310
    }
62225f9da938 rhg: Sort `rhg status` output correctly
Simon Sapin <simon.sapin@octobus.net>
parents: 47110
diff changeset
   311
    if display_states.clean {
48349
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   312
        display_status_paths(
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   313
            ui,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   314
            repo,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   315
            config,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   316
            no_status,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   317
            &mut ds_status.clean,
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   318
            b"C",
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   319
        )?;
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   320
    }
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   321
    Ok(())
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   322
}
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   323
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   324
// Probably more elegant to use a Deref or Borrow trait rather than
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   325
// harcode HgPathBuf, but probably not really useful at this point
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   326
fn display_status_paths(
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   327
    ui: &Ui,
48175
707c58880cd0 rhg: add relative paths support in `rhg status`
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48171
diff changeset
   328
    repo: &Repo,
707c58880cd0 rhg: add relative paths support in `rhg status`
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48171
diff changeset
   329
    config: &Config,
48349
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   330
    no_status: bool,
47321
62225f9da938 rhg: Sort `rhg status` output correctly
Simon Sapin <simon.sapin@octobus.net>
parents: 47110
diff changeset
   331
    paths: &mut [HgPathCow],
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   332
    status_prefix: &[u8],
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   333
) -> Result<(), CommandError> {
47321
62225f9da938 rhg: Sort `rhg status` output correctly
Simon Sapin <simon.sapin@octobus.net>
parents: 47110
diff changeset
   334
    paths.sort_unstable();
48337
3bd62274cbc9 rhg: Propagate config errors in `rhg status`
Simon Sapin <simon.sapin@octobus.net>
parents: 48309
diff changeset
   335
    let mut relative: bool = config.get_bool(b"ui", b"relative-paths")?;
48175
707c58880cd0 rhg: add relative paths support in `rhg status`
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48171
diff changeset
   336
    relative = config
48337
3bd62274cbc9 rhg: Propagate config errors in `rhg status`
Simon Sapin <simon.sapin@octobus.net>
parents: 48309
diff changeset
   337
        .get_option(b"commands", b"status.relative")?
48175
707c58880cd0 rhg: add relative paths support in `rhg status`
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48171
diff changeset
   338
        .unwrap_or(relative);
48349
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   339
    let print_path = |path: &[u8]| {
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   340
        // TODO optim, probably lots of unneeded copies here, especially
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   341
        // if out stream is buffered
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   342
        if no_status {
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   343
            ui.write_stdout(&format_bytes!(b"{}\n", path))
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   344
        } else {
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   345
            ui.write_stdout(&format_bytes!(b"{} {}\n", status_prefix, path))
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   346
        }
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   347
    };
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   348
48176
38deb65d4441 rhg: add ui.plain() and check it before showing relative paths in status
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48175
diff changeset
   349
    if relative && !ui.plain() {
48349
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   350
        relativize_paths(repo, paths.iter().map(Ok), |path| {
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   351
            print_path(&path)
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   352
        })?;
48175
707c58880cd0 rhg: add relative paths support in `rhg status`
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48171
diff changeset
   353
    } else {
707c58880cd0 rhg: add relative paths support in `rhg status`
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48171
diff changeset
   354
        for path in paths {
48349
c12ed33558cb rhg: Add support for `rhg status -n`
Simon Sapin <simon.sapin@octobus.net>
parents: 48345
diff changeset
   355
            print_path(path.as_bytes())?
48175
707c58880cd0 rhg: add relative paths support in `rhg status`
Pulkit Goyal <7895pulkit@gmail.com>
parents: 48171
diff changeset
   356
        }
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   357
    }
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   358
    Ok(())
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   359
}
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   360
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   361
/// Check if a file is modified by comparing actual repo store and file system.
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   362
///
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   363
/// This meant to be used for those that the dirstate cannot resolve, due
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   364
/// to time resolution limits.
48344
b6d8eea9872c rhg: Rename cat_file_is_modified
Simon Sapin <simon.sapin@octobus.net>
parents: 48343
diff changeset
   365
fn unsure_is_modified(
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   366
    repo: &Repo,
47964
796206e74b10 rhg: Reuse manifest when checking status of multiple ambiguous files
Simon Sapin <simon.sapin@octobus.net>
parents: 47956
diff changeset
   367
    manifest: &Manifest,
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   368
    hg_path: &HgPath,
47964
796206e74b10 rhg: Reuse manifest when checking status of multiple ambiguous files
Simon Sapin <simon.sapin@octobus.net>
parents: 47956
diff changeset
   369
) -> Result<bool, HgError> {
48345
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   370
    let vfs = repo.working_directory_vfs();
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   371
    let fs_path = hg_path_to_os_string(hg_path).expect("HgPath conversion");
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   372
    let fs_metadata = vfs.symlink_metadata(&fs_path)?;
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   373
    let is_symlink = fs_metadata.file_type().is_symlink();
48391
b80e5e75d51e dirstate: remove `lastnormaltime` mechanism
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48349
diff changeset
   374
    // TODO: Also account for `FALLBACK_SYMLINK` and `FALLBACK_EXEC` from the
b80e5e75d51e dirstate: remove `lastnormaltime` mechanism
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48349
diff changeset
   375
    // dirstate
48345
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   376
    let fs_flags = if is_symlink {
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   377
        Some(b'l')
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   378
    } else if has_exec_bit(&fs_metadata) {
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   379
        Some(b'x')
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   380
    } else {
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   381
        None
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   382
    };
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   383
48343
eb428010aad2 rhg: Also parse flags in the manifest parser
Simon Sapin <simon.sapin@octobus.net>
parents: 48342
diff changeset
   384
    let entry = manifest
47964
796206e74b10 rhg: Reuse manifest when checking status of multiple ambiguous files
Simon Sapin <simon.sapin@octobus.net>
parents: 47956
diff changeset
   385
        .find_file(hg_path)?
796206e74b10 rhg: Reuse manifest when checking status of multiple ambiguous files
Simon Sapin <simon.sapin@octobus.net>
parents: 47956
diff changeset
   386
        .expect("ambgious file not in p1");
48345
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   387
    if entry.flags != fs_flags {
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   388
        return Ok(true);
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   389
    }
47964
796206e74b10 rhg: Reuse manifest when checking status of multiple ambiguous files
Simon Sapin <simon.sapin@octobus.net>
parents: 47956
diff changeset
   390
    let filelog = repo.filelog(hg_path)?;
48343
eb428010aad2 rhg: Also parse flags in the manifest parser
Simon Sapin <simon.sapin@octobus.net>
parents: 48342
diff changeset
   391
    let filelog_entry =
eb428010aad2 rhg: Also parse flags in the manifest parser
Simon Sapin <simon.sapin@octobus.net>
parents: 48342
diff changeset
   392
        filelog.data_for_node(entry.node_id()?).map_err(|_| {
eb428010aad2 rhg: Also parse flags in the manifest parser
Simon Sapin <simon.sapin@octobus.net>
parents: 48342
diff changeset
   393
            HgError::corrupted("filelog missing node from manifest")
eb428010aad2 rhg: Also parse flags in the manifest parser
Simon Sapin <simon.sapin@octobus.net>
parents: 48342
diff changeset
   394
        })?;
47964
796206e74b10 rhg: Reuse manifest when checking status of multiple ambiguous files
Simon Sapin <simon.sapin@octobus.net>
parents: 47956
diff changeset
   395
    let contents_in_p1 = filelog_entry.data()?;
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   396
48345
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   397
    let fs_contents = if is_symlink {
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   398
        get_bytes_from_os_string(vfs.read_link(fs_path)?.into_os_string())
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   399
    } else {
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   400
        vfs.read(fs_path)?
d5a91701f7dc rhg: Fix status desambiguation of symlinks and executable files
Simon Sapin <simon.sapin@octobus.net>
parents: 48344
diff changeset
   401
    };
48309
594cf89047c8 rhg: Fix `rhg status` file content comparison
Simon Sapin <simon.sapin@octobus.net>
parents: 48260
diff changeset
   402
    return Ok(contents_in_p1 != &*fs_contents);
46822
c71e8d9e7f2a rhg: Initial support for the 'status' command
Georges Racinet <georges.racinet@octobus.net>
parents:
diff changeset
   403
}