D9945: debugdiscovery: add flags to run discovery on subsets of the local repo
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Generating new repository using strip of local clone is very expensive for large repositories. And such large repository are the most likely to requires debugging around discovery. So we add a simple way to run discovery using provided sets of heads. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9945 AFFECTED FILES mercurial/debugcommands.py tests/test-completion.t tests/test-setdiscovery.t CHANGE DETAILS diff --git a/tests/test-setdiscovery.t b/tests/test-setdiscovery.t --- a/tests/test-setdiscovery.t +++ b/tests/test-setdiscovery.t @@ -1588,3 +1588,139 @@ common:0 missing: 1 common heads: 66f7d451a68b + + $ cd .. + + +Test debuging discovery using different subset of the same repository += + +remote is a local subset + + +remote will be last 25 heads of the local graph + + $ cd $TESTTMP/manyheads + $ hg -R a debugdiscovery \ + > --debug \ + > --remote-as-revs 'last(heads(all()), 25)' \ + > --config devel.discovery.randomize=false + query 1; heads + searching for changes + all remote heads known locally + elapsed time: * seconds (glob) + round-trips: 1 + heads summary: +total common heads: 25 + also local heads: 25 + also remote heads:25 + both: 25 +local heads: 260 + common: 25 + missing: 235 +remote heads: 25 + common: 25 + unknown: 0 + local changesets: 1340 +common:400 + heads:25 + roots: 1 +missing: 940 + heads: 235 + roots: 235 +first undecided set: 940 + heads: 235 + roots: 235 + common:0 + missing: 940 + common heads: 0dfd965d91c6 0fe09b60448d 14a17233ce9d 175c0a3072cf 1c51e2c80832 1e51600e0698 24eb5f9bdbab 25ce09526613 36bd00abde57 426989fdefa0 596d87362679 5dd1039ea5c0 5ef24f022278 5f230dc19419 80b39998accb 88f40688ffb5 9e37ddf8c632 abf4d55b075e b2ce801fddfe b368b6ac3ce3 c959bf2e869c c9fba6ba4e2e d783207cf649 d9a51e256f21 e3717a4e3753 + +local is a local subset + + +remote will be last 25 heads of the local graph + + $ cd $TESTTMP/manyheads + $ hg -R a debugdiscovery b \ + > --debug \ + > --local-as-revs 'first(heads(all()), 25)' \ + > --config devel.discovery.randomize=false + comparing with b + query 1; heads + searching for changes + taking quick initial sample + query 2; still undecided: 375, sample size is: 81 + sampling from both directions + query 3; still undecided: 3, sample size is: 3 + 3 total queries *s (glob) + elapsed time: * seconds (glob) + round-trips: 3 + heads summary: +total common heads: 1 + also local heads: 0 + also remote heads: 0 + both: 0 +local heads:25 + common:0 + missing: 25 +remote heads:1 + common:0 + unknown: 1 + local changesets:400 +common:300 + heads: 1 + roots: 1 +missing: 100 + heads:25 + roots:25 +first undecided set: 400 + heads:25 + roots: 1 + common: 300 + missing: 100 + common heads: 3ee37d65064a + +both local and remove are subset + + +remote will be last 25 heads of the local graph + + $ cd $TESTTMP/manyheads + $ hg -R a debugdiscovery \ + > --debug \ + > --local-as-revs 'first(heads(all()), 25)' \ + > --remote-as-revs 'last(heads(all()), 25)' \ + > --config devel.discovery.randomize=false + query 1; heads + searching for changes + taking quick initial sample + query 2; still undecided: 375, sample size is: 81 + sampling from both directions + query 3; still undecided: 3, sample size is: 3 + 3 total queries in *s (glob) + elapsed time: * seconds (glob) + round-trips: 3 + heads summary: +total common heads: 1 + also local heads: 0 + also remote heads: 0 + both: 0 +local heads:25 + common:0 + missing: 25 +remote heads:
mercurial-devel | Pipeline #17449 has failed for branch/default | 7ab977d8
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: 7ab977d8 ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/7ab977d8e8f105aa7befe2cef910ee2866cc7d85 ) Commit Message: relnotes: add entry for `hg diff --merge -c` D... Commit Author: Augie Fackler Pipeline #17449 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/17449 ) triggered by Administrator ( https://foss.heptapod.net/root ) had 4 failed builds. Job #162534 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162534/raw ) Stage: tests Name: test-py2-rust Job #162530 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162530/raw ) Stage: tests Name: test-py2 Job #162536 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162536/raw ) Stage: tests Name: test-py2-chg Job #162532 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162532/raw ) Stage: tests Name: test-py2-pure -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9944: relnotes: add entry for `hg diff --merge -c`
durin42 created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9944 AFFECTED FILES relnotes/next CHANGE DETAILS diff --git a/relnotes/next b/relnotes/next --- a/relnotes/next +++ b/relnotes/next @@ -5,6 +5,10 @@ * The `rev-branch-cache` is now updated incrementally whenever changesets are added. + * `hg diff` now takes an experimental `--merge` flag which causes `hg +diff --change` to show the changes relative to an automerge for +merge changesets. This makes it easier to detect and review manual +changes performed in merge changesets. == New Experimental Features == To: durin42, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #17446 has failed for branch/default | c9d765b5
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: c9d765b5 ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/c9d765b50d7af04db408b088325616f227ada847 ) Commit Message: branching: merge with stable Commit Author: Martin von Zweigbergk ( https://foss.heptapod.net/martinvonz ) Pipeline #17446 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/17446 ) triggered by Administrator ( https://foss.heptapod.net/root ) had 5 failed builds. Job #162504 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162504/raw ) Stage: tests Name: test-py2 Job #162508 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162508/raw ) Stage: tests Name: test-py2-rust Job #162510 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162510/raw ) Stage: tests Name: test-py2-chg Job #162506 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162506/raw ) Stage: tests Name: test-py2-pure Job #162511 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162511/raw ) Stage: tests Name: test-py3-chg -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9943: relnotes: elaborate on the side effects of hooks having HGPLAIN=1
mharbison72 created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH stable REVISION DETAIL https://phab.mercurial-scm.org/D9943 AFFECTED FILES relnotes/next CHANGE DETAILS diff --git a/relnotes/next b/relnotes/next --- a/relnotes/next +++ b/relnotes/next @@ -37,7 +37,11 @@ is also supported by "premerge" as `merge-tools..premerge=keep-mergediff`. - * External hooks are now called with `HGPLAIN=1` preset. + * External hooks are now called with `HGPLAIN=1` preset. This has the side + effect of ignoring aliases, templates, revsetaliases, and a few other config + options in any `hg` command spawned by the hook. The previous behavior + can be restored by setting HGPLAINEXCEPT appropriately in the parent process. + See `hg help environment` for the list of items, and how to set it. * The `branchmap` cache is updated more intelligently and can be significantly faster for repositories with many branches and changesets. To: mharbison72, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@46415: new changeset (1 on stable)
New changeset (1 on stable) in mercurial: https://www.mercurial-scm.org/repo/hg/rev/8deab876fb59 changeset: 46415:8deab876fb59 branch: stable tag: tip parent: 46413:ed43b6fa847e user:Kyle Lippincott date:Wed Jan 27 10:29:21 2021 -0800 summary: wix: tell ComponentSearch that it is finding a directory (not a file) -- Repository URL: https://www.mercurial-scm.org/repo/hg ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9941: rhg: initial support for shared repositories
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9941 AFFECTED FILES rust/hg-core/src/errors.rs rust/hg-core/src/repo.rs rust/hg-core/src/requirements.rs rust/rhg/src/commands/debugrequirements.rs tests/test-rhg.t CHANGE DETAILS diff --git a/tests/test-rhg.t b/tests/test-rhg.t --- a/tests/test-rhg.t +++ b/tests/test-rhg.t @@ -218,9 +218,9 @@ $ cd repo2 $ rhg files - [252] + a $ rhg cat -r 0 a - [252] + a Same with relative sharing @@ -231,9 +231,9 @@ $ cd repo3 $ rhg files - [252] + a $ rhg cat -r 0 a - [252] + a Same with share-safe diff --git a/rust/rhg/src/commands/debugrequirements.rs b/rust/rhg/src/commands/debugrequirements.rs --- a/rust/rhg/src/commands/debugrequirements.rs +++ b/rust/rhg/src/commands/debugrequirements.rs @@ -2,7 +2,6 @@ use crate::error::CommandError; use crate::ui::Ui; use hg::repo::Repo; -use hg::requirements; pub const HELP_TEXT: = " Print the current repo requirements. @@ -20,8 +19,10 @@ fn run(, ui: ) -> Result<(), CommandError> { let repo = Repo::find()?; let mut output = String::new(); -for req in requirements::load()? { -output.push_str(); +let mut requirements: Vec<_> = repo.requirements().iter().collect(); +requirements.sort(); +for req in requirements { +output.push_str(req); output.push('\n'); } ui.write_stdout(output.as_bytes())?; diff --git a/rust/hg-core/src/requirements.rs b/rust/hg-core/src/requirements.rs --- a/rust/hg-core/src/requirements.rs +++ b/rust/hg-core/src/requirements.rs @@ -1,7 +1,8 @@ use crate::errors::{HgError, HgResultExt}; -use crate::repo::Repo; +use crate::repo::{Repo, Vfs}; +use std::collections::HashSet; -fn parse(bytes: &[u8]) -> Result, HgError> { +fn parse(bytes: &[u8]) -> Result, HgError> { // The Python code reading this file uses `str.splitlines` // which looks for a number of line separators (even including a couple of // non-ASCII ones), but Python code writing it always uses `\n`. @@ -21,10 +22,8 @@ .collect() } -pub fn load(repo: ) -> Result, HgError> { -if let Some(bytes) = -repo.hg_vfs().read("requires").io_not_found_as_none()? -{ +pub(crate) fn load_if_exists(hg_vfs: Vfs) -> Result, HgError> { +if let Some(bytes) = hg_vfs.read("requires").io_not_found_as_none()? { parse() } else { // Treat a missing file the same as an empty file. @@ -34,13 +33,13 @@ // > the repository. This file was introduced in Mercurial 0.9.2, // > which means very old repositories may not have one. We assume // > a missing file translates to no requirements. -Ok(Vec::new()) +Ok(HashSet::new()) } } -pub fn check(repo: ) -> Result<(), HgError> { -for feature in load(repo)? { -if !SUPPORTED.contains(&&*feature) { +pub(crate) fn check(repo: ) -> Result<(), HgError> { +for feature in repo.requirements() { +if !SUPPORTED.contains(_str()) { // TODO: collect and all unknown features and include them in the // error message? return Err(HgError::UnsupportedFeature(format!( @@ -58,10 +57,77 @@ "fncache", "generaldelta", "revlogv1", -"sparserevlog", +SHARED_REQUIREMENT, +SPARSEREVLOG_REQUIREMENT, +RELATIVE_SHARED_REQUIREMENT, "store", // As of this writing everything rhg does is read-only. // When it starts writing to the repository, it’ll need to either keep the // persistent nodemap up to date or remove this entry: "persistent-nodemap", ]; + +// Copied from mercurial/requirements.py: + +/// When narrowing is finalized and no longer subject to format changes, +/// we should move this to just "narrow" or similar. +#[allow(unused)] +pub(crate) const NARROW_REQUIREMENT: = "narrowhg-experimental"; + +/// Enables sparse working directory usage +#[allow(unused)] +pub(crate) const SPARSE_REQUIREMENT: = "exp-sparse"; + +/// Enables the internal phase which is used to hide changesets instead +/// of stripping them +#[allow(unused)] +pub(crate) const INTERNAL_PHASE_REQUIREMENT: = "internal-phase"; + +/// Stores manifest in Tree structure +#[allow(unused)] +pub(crate) const TREEMANIFEST_REQUIREMENT: = "treemanifest"; + +/// Increment the sub-version when the revlog v2 format changes to lock out old +/// clients. +#[allow(unused)] +pub(crate) const REVLOGV2_REQUIREMENT: = "exp-revlogv2.1"; + +/// A repository with the sparserevlog feature will have delta chains that +/// can spread over a larger span. Sparse reading cuts these large spans into +/// pieces, so that each piece isn't too big. +/// Without the sparserevlog capability, reading from the repository could use +/// huge amounts of memory,
D9942: rhg: add support for share-safe
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9942 AFFECTED FILES rust/hg-core/src/repo.rs rust/hg-core/src/requirements.rs tests/test-rhg.t CHANGE DETAILS diff --git a/tests/test-rhg.t b/tests/test-rhg.t --- a/tests/test-rhg.t +++ b/tests/test-rhg.t @@ -256,7 +256,7 @@ $ cd repo5 $ rhg files - [252] + a $ rhg cat -r 0 a - [252] + a diff --git a/rust/hg-core/src/requirements.rs b/rust/hg-core/src/requirements.rs --- a/rust/hg-core/src/requirements.rs +++ b/rust/hg-core/src/requirements.rs @@ -22,6 +22,10 @@ .collect() } +pub(crate) fn load(hg_vfs: Vfs) -> Result, HgError> { +parse(_vfs.read("requires")?) +} + pub(crate) fn load_if_exists(hg_vfs: Vfs) -> Result, HgError> { if let Some(bytes) = hg_vfs.read("requires").io_not_found_as_none()? { parse() @@ -58,6 +62,7 @@ "generaldelta", "revlogv1", SHARED_REQUIREMENT, +SHARESAFE_REQUIREMENT, SPARSEREVLOG_REQUIREMENT, RELATIVE_SHARED_REQUIREMENT, "store", @@ -130,4 +135,4 @@ /// store and working copy requirements i.e. both `.hg/requires` and /// `.hg/store/requires` are present. #[allow(unused)] -pub(crate) const SHARESAFE_REQUIREMENT: = "exp-sharesafe"; +pub(crate) const SHARESAFE_REQUIREMENT: = "share-safe"; diff --git a/rust/hg-core/src/repo.rs b/rust/hg-core/src/repo.rs --- a/rust/hg-core/src/repo.rs +++ b/rust/hg-core/src/repo.rs @@ -47,15 +47,34 @@ /// To be called after checking that `.hg` is a sub-directory fn new_at_path(working_directory: PathBuf) -> Result { let dot_hg = working_directory.join(".hg"); + let hg_vfs = Vfs { base: _hg }; -let reqs = requirements::load_if_exists(hg_vfs)?; +let mut reqs = requirements::load_if_exists(hg_vfs)?; let relative = reqs.contains(requirements::RELATIVE_SHARED_REQUIREMENT); let shared = reqs.contains(requirements::SHARED_REQUIREMENT) || relative; + +// From `mercurial/localrepo.py`: +// +// if .hg/requires contains the sharesafe requirement, it means +// there exists a `.hg/store/requires` too and we should read it +// NOTE: presence of SHARESAFE_REQUIREMENT imply that store requirement +// is present. We never write SHARESAFE_REQUIREMENT for a repo if store +// is not present, refer checkrequirementscompat() for that +// +// However, if SHARESAFE_REQUIREMENT is not present, it means that the +// repository was shared the old way. We check the share source +// .hg/requires for SHARESAFE_REQUIREMENT to detect whether the +// current repository needs to be reshared +let share_safe = reqs.contains(requirements::SHARESAFE_REQUIREMENT); + let store_path; if !shared { store_path = dot_hg.join("store"); +if share_safe { +reqs.extend(requirements::load(Vfs { base: _path })?); +} } else { let bytes = hg_vfs.read("sharedpath")?; let mut shared_path = get_path_from_bytes().to_owned(); @@ -70,6 +89,17 @@ } store_path = shared_path.join("store"); + +let source_is_share_safe = +requirements::load(Vfs { base: _path })? +.contains(requirements::SHARESAFE_REQUIREMENT); + +// TODO: support for `share.safe-mismatch.*` config +if share_safe && !source_is_share_safe { +return Err(HgError::unsupported("share-safe downgrade")); +} else if source_is_share_safe && !share_safe { +return Err(HgError::unsupported("share-safe upgrade")); +} } let repo = Self { To: SimonSapin, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9940: rhg: Add basic test with a shared repository
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9940 AFFECTED FILES tests/test-rhg.t CHANGE DETAILS diff --git a/tests/test-rhg.t b/tests/test-rhg.t --- a/tests/test-rhg.t +++ b/tests/test-rhg.t @@ -196,3 +196,67 @@ of $ rhg cat -r c3ae8dec9fad of r5000 + +Crate a shared repository + + $ echo "[extensions]" >> $HGRCPATH + $ echo "share = " >> $HGRCPATH + + $ cd $TESTTMP + $ hg init repo1 + $ cd repo1 + $ echo a > a + $ hg commit -A -m'init' + adding a + + $ cd .. + $ hg share repo1 repo2 + updating working directory + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + +And check that basic rhg commands work with sharing + + $ cd repo2 + $ rhg files + [252] + $ rhg cat -r 0 a + [252] + +Same with relative sharing + + $ cd .. + $ hg share repo2 repo3 --relative + updating working directory + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ cd repo3 + $ rhg files + [252] + $ rhg cat -r 0 a + [252] + +Same with share-safe + + $ echo "[format]" >> $HGRCPATH + $ echo "use-share-safe = True" >> $HGRCPATH + + $ cd $TESTTMP + $ hg init repo4 + $ cd repo4 + $ echo a > a + $ hg commit -A -m'init' + adding a + + $ cd .. + $ hg share repo4 repo5 + updating working directory + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + +And check that basic rhg commands work with sharing + + $ cd repo5 + $ rhg files + [252] + $ rhg cat -r 0 a + [252] + To: SimonSapin, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #17439 has failed for branch/default | 54ca95a8
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: 54ca95a8 ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/54ca95a8bc3f57f017becf2d16f93ee90b41806a ) Commit Message: diff: suppress `merging foo` output lines when ... Commit Author: Augie Fackler Pipeline #17439 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/17439 ) triggered by Administrator ( https://foss.heptapod.net/root ) had 4 failed builds. Job #162419 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162419/raw ) Stage: tests Name: test-py2-chg Job #162417 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162417/raw ) Stage: tests Name: test-py2-rust Job #162413 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162413/raw ) Stage: tests Name: test-py2 Job #162415 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162415/raw ) Stage: tests Name: test-py2-pure -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #17436 has failed for branch/default | 6de20600
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: 6de20600 ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/6de2060029dd8637ba2cad7e3e7923aefa89d032 ) Commit Message: rust: use HgError in ConfigError Differential ... Commit Author: Simon Sapin ( https://foss.heptapod.net/SimonSapin ) Pipeline #17436 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/17436 ) triggered by Administrator ( https://foss.heptapod.net/root ) had 4 failed builds. Job #162367 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162367/raw ) Stage: tests Name: test-py2-chg Job #162365 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162365/raw ) Stage: tests Name: test-py2-rust Job #162363 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162363/raw ) Stage: tests Name: test-py2-pure Job #162361 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/162361/raw ) Stage: tests Name: test-py2 -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9939: diff: suppress `merging foo` output lines when performing a merge diff
durin42 created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9939 AFFECTED FILES mercurial/commands.py tests/test-diff-change.t CHANGE DETAILS diff --git a/tests/test-diff-change.t b/tests/test-diff-change.t --- a/tests/test-diff-change.t +++ b/tests/test-diff-change.t @@ -197,7 +197,6 @@ merge diff should show only manual edits to a merge: $ hg diff --merge -c 6 - merging file.txt (no diff output is expected here) Construct an "evil merge" that does something other than just the merge. @@ -228,7 +227,6 @@ up, making it easy to identify changes someone is otherwise trying to sneak into a merge. $ hg diff --merge -c 7 - merging file.txt diff -r 8ad85e839ba7 file.txt --- a/file.txt Thu Jan 01 00:00:00 1970 + +++ b/file.txt Thu Jan 01 00:00:00 1970 + @@ -277,7 +275,6 @@ +this file is new in p2 of the merge With --merge, it's a diff against the conflicted content. $ hg diff --merge -c 11 - merging file.txt diff -r 5010caab09f6 file.txt --- a/file.txt Thu Jan 01 00:00:00 1970 + +++ b/file.txt Thu Jan 01 00:00:00 1970 + diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2567,7 +2567,7 @@ pctx1 = mctx.p1() pctx2 = mctx.p2() wctx = contextmod.overlayworkingctx(repo) -wctx.setbase(ctx1) +wctx.setbase(pctx1) with ui.configoverride( { ( @@ -2577,7 +2577,9 @@ }, b'diff --merge', ): +repo.ui.pushbuffer() stats = mergemod.merge(pctx2, wc=wctx) +repo.ui.popbuffer() ctx1 = wctx ctx2 = mctx else: To: durin42, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9938: rust: use HgError in ConfigError
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9938 AFFECTED FILES rust/hg-core/src/config/config.rs rust/hg-core/src/config/layer.rs CHANGE DETAILS diff --git a/rust/hg-core/src/config/layer.rs b/rust/hg-core/src/config/layer.rs --- a/rust/hg-core/src/config/layer.rs +++ b/rust/hg-core/src/config/layer.rs @@ -7,6 +7,7 @@ // This software may be used and distributed according to the terms of the // GNU General Public License version 2 or any later version. +use crate::errors::{HgError, IoResultExt}; use crate::utils::files::{ get_bytes_from_path, get_path_from_bytes, read_whole_file, }; @@ -99,20 +100,12 @@ if let Some(m) = INCLUDE_RE.captures() { let filename_bytes = [1]; let filename_to_include = get_path_from_bytes(_bytes); -match read_include(, _to_include) { -(include_src, Ok(data)) => { -layers.push(current_layer); -layers.extend(Self::parse(_src, )?); -current_layer = -Self::new(ConfigOrigin::File(src.to_owned())); -} -(_, Err(e)) => { -return Err(ConfigError::IncludeError { -path: filename_to_include.to_owned(), -io_error: e, -}) -} -} +let (include_src, result) = +read_include(, _to_include); +let data = result.for_file(filename_to_include)?; +layers.push(current_layer); +layers.extend(Self::parse(_src, )?); +current_layer = Self::new(ConfigOrigin::File(src.to_owned())); } else if let Some(_) = EMPTY_RE.captures() { } else if let Some(m) = SECTION_RE.captures() { section = m[1].to_vec(); @@ -145,11 +138,12 @@ map.remove([1]); } } else { -return Err(ConfigError::Parse { +return Err(ConfigParseError { origin: ConfigOrigin::File(src.to_owned()), line: Some(index + 1), bytes: bytes.to_owned(), -}); +} +.into()); } } if !current_layer.is_empty() { @@ -226,21 +220,17 @@ } } +#[derive(Debug)] +pub struct ConfigParseError { +pub origin: ConfigOrigin, +pub line: Option, +pub bytes: Vec, +} + #[derive(Debug, derive_more::From)] pub enum ConfigError { -Parse { -origin: ConfigOrigin, -line: Option, -bytes: Vec, -}, -/// Failed to include a sub config file -IncludeError { -path: PathBuf, -io_error: std::io::Error, -}, -/// Any IO error that isn't expected -#[from] -IO(std::io::Error), +Parse(ConfigParseError), +Other(HgError), } fn make_regex(pattern: &'static str) -> Regex { diff --git a/rust/hg-core/src/config/config.rs b/rust/hg-core/src/config/config.rs --- a/rust/hg-core/src/config/config.rs +++ b/rust/hg-core/src/config/config.rs @@ -8,7 +8,9 @@ // GNU General Public License version 2 or any later version. use super::layer; -use crate::config::layer::{ConfigError, ConfigLayer, ConfigValue}; +use crate::config::layer::{ +ConfigError, ConfigLayer, ConfigParseError, ConfigValue, +}; use std::path::PathBuf; use crate::repo::Repo; @@ -89,11 +91,11 @@ , section: &[u8], item: &[u8], -) -> Result, ConfigError> { +) -> Result, ConfigParseError> { match self.get_inner(, ) { Some((layer, v)) => match parse_bool() { Some(b) => Ok(Some(b)), -None => Err(ConfigError::Parse { +None => Err(ConfigParseError { origin: layer.origin.to_owned(), line: v.line, bytes: v.bytes.to_owned(), To: SimonSapin, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel