Details
Details
- Reviewers
Alphare - Group Reviewers
hg-reviewers - Commits
- rHG7f633432ca92: rhg: Sub-repositories are not supported
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
( )
Alphare |
hg-reviewers |
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | rust/hg-core/src/repo.rs (8 lines) | |||
M | rust/rhg/src/main.rs (9 lines) | |||
M | tests/test-subrepo-deep-nested-change.t (4 lines) | |||
M | tests/test-subrepo-missing.t (4 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
7653a363e3a5 | 4afb9627dc77 | Simon Sapin | Nov 9 2021, 12:17 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | SimonSapin | ||
Closed | SimonSapin | ||
Closed | SimonSapin | ||
Closed | SimonSapin |
self.manifestlog()?.data_for_node( | self.manifestlog()?.data_for_node( | ||||
self.changelog()? | self.changelog()? | ||||
.data_for_rev(revision)? | .data_for_rev(revision)? | ||||
.manifest_node()? | .manifest_node()? | ||||
.into(), | .into(), | ||||
) | ) | ||||
} | } | ||||
pub fn has_subrepos(&self) -> Result<bool, DirstateError> { | |||||
if let Some(entry) = self.dirstate_map()?.get(HgPath::new(".hgsub"))? { | |||||
Ok(entry.state().is_tracked()) | |||||
} else { | |||||
Ok(false) | |||||
} | |||||
} | |||||
pub fn filelog(&self, path: &HgPath) -> Result<Filelog, HgError> { | pub fn filelog(&self, path: &HgPath) -> Result<Filelog, HgError> { | ||||
Filelog::open(self, path) | Filelog::open(self, path) | ||||
} | } | ||||
/// Write to disk any updates that were made through `dirstate_map_mut`. | /// Write to disk any updates that were made through `dirstate_map_mut`. | ||||
/// | /// | ||||
/// The "wlock" must be held while calling this. | /// The "wlock" must be held while calling this. | ||||
/// See for example `try_with_wlock_no_wait`. | /// See for example `try_with_wlock_no_wait`. |
} | } | ||||
fn main_with_result( | fn main_with_result( | ||||
process_start_time: &blackbox::ProcessStartTime, | process_start_time: &blackbox::ProcessStartTime, | ||||
ui: &ui::Ui, | ui: &ui::Ui, | ||||
repo: Result<&Repo, &NoRepoInCwdError>, | repo: Result<&Repo, &NoRepoInCwdError>, | ||||
config: &Config, | config: &Config, | ||||
) -> Result<(), CommandError> { | ) -> Result<(), CommandError> { | ||||
check_unsupported(config, ui)?; | check_unsupported(config, repo, ui)?; | ||||
let app = App::new("rhg") | let app = App::new("rhg") | ||||
.global_setting(AppSettings::AllowInvalidUtf8) | .global_setting(AppSettings::AllowInvalidUtf8) | ||||
.global_setting(AppSettings::DisableVersion) | .global_setting(AppSettings::DisableVersion) | ||||
.setting(AppSettings::SubcommandRequired) | .setting(AppSettings::SubcommandRequired) | ||||
.setting(AppSettings::VersionlessSubcommands) | .setting(AppSettings::VersionlessSubcommands) | ||||
.arg( | .arg( | ||||
Arg::with_name("repository") | Arg::with_name("repository") | ||||
join(unsupported, b", ") | join(unsupported, b", ") | ||||
), | ), | ||||
}) | }) | ||||
} | } | ||||
} | } | ||||
fn check_unsupported( | fn check_unsupported( | ||||
config: &Config, | config: &Config, | ||||
repo: Result<&Repo, &NoRepoInCwdError>, | |||||
ui: &ui::Ui, | ui: &ui::Ui, | ||||
) -> Result<(), CommandError> { | ) -> Result<(), CommandError> { | ||||
check_extensions(config)?; | check_extensions(config)?; | ||||
if std::env::var_os("HG_PENDING").is_some() { | if std::env::var_os("HG_PENDING").is_some() { | ||||
// TODO: only if the value is `== repo.working_directory`? | // TODO: only if the value is `== repo.working_directory`? | ||||
// What about relative v.s. absolute paths? | // What about relative v.s. absolute paths? | ||||
Err(CommandError::unsupported("$HG_PENDING"))? | Err(CommandError::unsupported("$HG_PENDING"))? | ||||
} | } | ||||
if let Ok(repo) = repo { | |||||
if repo.has_subrepos()? { | |||||
Err(CommandError::unsupported("sub-repositories"))? | |||||
} | |||||
} | |||||
if config.has_non_empty_section(b"encode") { | if config.has_non_empty_section(b"encode") { | ||||
Err(CommandError::unsupported("[encode] config"))? | Err(CommandError::unsupported("[encode] config"))? | ||||
} | } | ||||
if config.has_non_empty_section(b"decode") { | if config.has_non_empty_section(b"decode") { | ||||
Err(CommandError::unsupported("[decode] config"))? | Err(CommandError::unsupported("[decode] config"))? | ||||
} | } | ||||
if let Some(color) = config.get(b"ui", b"color") { | if let Some(color) = config.get(b"ui", b"color") { | ||||
if (color == b"always" || color == b"debug") && !ui.plain() { | if (color == b"always" || color == b"debug") && !ui.plain() { | ||||
Err(CommandError::unsupported("colored output"))? | Err(CommandError::unsupported("colored output"))? | ||||
} | } | ||||
} | } | ||||
Ok(()) | Ok(()) | ||||
} | } |
TODO: fix rhg bugs that make this test fail when status is enabled | |||||
$ unset RHG_STATUS | |||||
$ cat >> $HGRCPATH <<EOF | $ cat >> $HGRCPATH <<EOF | ||||
> [extdiff] | > [extdiff] | ||||
> # for portability: | > # for portability: | ||||
> pdiff = sh "$RUNTESTDIR/pdiff" | > pdiff = sh "$RUNTESTDIR/pdiff" | ||||
> [progress] | > [progress] | ||||
> disable=False | > disable=False | ||||
> assume-tty = 1 | > assume-tty = 1 | ||||
> delay = 0 | > delay = 0 |
TODO: fix rhg bugs that make this test fail when status is enabled | |||||
$ unset RHG_STATUS | |||||
$ hg init repo | $ hg init repo | ||||
$ cd repo | $ cd repo | ||||
$ hg init subrepo | $ hg init subrepo | ||||
$ echo a > subrepo/a | $ echo a > subrepo/a | ||||
$ hg -R subrepo ci -Am adda | $ hg -R subrepo ci -Am adda | ||||
adding a | adding a | ||||
$ echo 'subrepo = subrepo' > .hgsub | $ echo 'subrepo = subrepo' > .hgsub | ||||
$ hg ci -Am addsubrepo | $ hg ci -Am addsubrepo |