[Bug 6501] New: Rebase switches parent order of merge
https://bz.mercurial-scm.org/show_bug.cgi?id=6501 Bug ID: 6501 Summary: Rebase switches parent order of merge Product: Mercurial Version: unspecified Hardware: PC OS: Linux Status: UNCONFIRMED Severity: bug Priority: wish Component: rebase Assignee: bugzi...@mercurial-scm.org Reporter: m...@manueljacob.de CC: mercurial-devel@mercurial-scm.org Python Version: --- $ cat >> $HGRCPATH < [extensions] > rebase = > [experimental] > evolution = all > EOF $ hg init $ touch test1 test2 $ hg add test1 test2 $ hg ci -m base $ echo left > test1 $ hg ci -m left -q $ hg up 0 -q $ echo right1 > test2 $ hg ci -m right1 -q $ hg up 0 -q $ echo right2 > test2 $ hg ci -m right2 -q $ hg up 2 -q $ touch test3 $ hg add test3 $ hg ci -m right $ hg up 1 -q $ hg merge 4 -q $ hg ci -m merge $ hg log -G @changeset: 5:fba4923e310a |\ tag: tip | | parent: 1:429ab2e55fe3 | | parent: 4:590a481a3fab | | user:test | | date:Thu Jan 01 00:00:00 1970 + | | summary: merge | | | o changeset: 4:590a481a3fab | | parent: 2:db5f9ff551fb | | user:test | | date:Thu Jan 01 00:00:00 1970 + | | summary: right | | | | o changeset: 3:ea268a950081 | | | parent: 0:477af4eeb07e | | | user:test | | | date:Thu Jan 01 00:00:00 1970 + | | | summary: right2 | | | | o | changeset: 2:db5f9ff551fb | |/ parent: 0:477af4eeb07e | |user:test | |date:Thu Jan 01 00:00:00 1970 + | |summary: right1 | | o | changeset: 1:429ab2e55fe3 |/ user:test |date:Thu Jan 01 00:00:00 1970 + |summary: left | o changeset: 0:477af4eeb07e user:test date:Thu Jan 01 00:00:00 1970 + summary: base $ hg rebase -d 3 -s 4 rebasing 4:590a481a3fab "right" rebasing 5:fba4923e310a tip "merge" $ hg log -G @changeset: 7:4244bf817b97 |\ tag: tip | | parent: 6:5fe7af8712dd | | parent: 1:429ab2e55fe3 | | user:test | | date:Thu Jan 01 00:00:00 1970 + | | summary: merge | | | o changeset: 6:5fe7af8712dd | | parent: 3:ea268a950081 | | user:test | | date:Thu Jan 01 00:00:00 1970 + | | summary: right | | | o changeset: 3:ea268a950081 | | parent: 0:477af4eeb07e | | user:test | | date:Thu Jan 01 00:00:00 1970 + | | summary: right2 | | | | o changeset: 2:db5f9ff551fb | |/ parent: 0:477af4eeb07e | |user:test | |date:Thu Jan 01 00:00:00 1970 + | |summary: right1 | | o | changeset: 1:429ab2e55fe3 |/ user:test |date:Thu Jan 01 00:00:00 1970 + |summary: left | o changeset: 0:477af4eeb07e user:test date:Thu Jan 01 00:00:00 1970 + summary: base Before the rebase, "left" is the first parent and "right" is the second parent. After the rebase, "right" is the first parent and "left" is the second parent, while "left" should stay the first parent and "right" should stay the second parent. This is basically the same problem as https://bz.mercurial-scm.org/show_bug.cgi?id=6141, but it is easier to add a test for it since reproducing it does not depend on out-of-tree extensions. -- You are receiving this mail because: You are on the CC list for the bug. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D10254: rhg: raise wdir specific error for `hg debugdata`
pulkit created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Helps remove the conditional in `test-debugcommands.t` for rhg. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D10254 AFFECTED FILES rust/hg-core/src/revlog.rs rust/hg-core/src/revlog/revlog.rs rust/hg-core/src/revset.rs rust/rhg/src/error.rs tests/test-debugcommands.t CHANGE DETAILS diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t --- a/tests/test-debugcommands.t +++ b/tests/test-debugcommands.t @@ -531,17 +531,9 @@ Test WdirUnsupported exception -#if no-rhg $ hg debugdata -c abort: working directory revision cannot be specified [255] -#else -TODO: add rhg support for (at least parsing) the working directory pseudo-changeset - $ hg debugdata -c - abort: working directory revision cannot be specified (missing-correct-output !) - abort: invalid revision identifier: (known-bad-output !) - [255] -#endif Test cache warming command diff --git a/rust/rhg/src/error.rs b/rust/rhg/src/error.rs --- a/rust/rhg/src/error.rs +++ b/rust/rhg/src/error.rs @@ -157,6 +157,9 @@ impl From<(RevlogError, )> for CommandError { fn from((err, rev): (RevlogError, )) -> CommandError { match err { +RevlogError::WDirUnsupported => CommandError::abort( +"abort: working directory revision cannot be specified", +), RevlogError::InvalidRevision => CommandError::abort(format!( "abort: invalid revision identifier: {}", rev diff --git a/rust/hg-core/src/revset.rs b/rust/hg-core/src/revset.rs --- a/rust/hg-core/src/revset.rs +++ b/rust/hg-core/src/revset.rs @@ -7,7 +7,7 @@ use crate::revlog::changelog::Changelog; use crate::revlog::revlog::{Revlog, RevlogError}; use crate::revlog::NodePrefix; -use crate::revlog::{Revision, NULL_REVISION}; +use crate::revlog::{Revision, NULL_REVISION, WORKING_DIRECTORY_HEX}; /// Resolve a query string into a single revision. /// @@ -50,6 +50,9 @@ return Ok(integer); } } +if input == WORKING_DIRECTORY_HEX { +return Err(RevlogError::WDirUnsupported); +} if let Ok(prefix) = NodePrefix::from_hex(input) { return revlog.get_node_rev(prefix); } diff --git a/rust/hg-core/src/revlog/revlog.rs b/rust/hg-core/src/revlog/revlog.rs --- a/rust/hg-core/src/revlog/revlog.rs +++ b/rust/hg-core/src/revlog/revlog.rs @@ -23,6 +23,8 @@ #[derive(derive_more::From)] pub enum RevlogError { InvalidRevision, +/// Working directory is not supported +WDirUnsupported, /// Found more than one entry whose ID match the requested prefix AmbiguousPrefix, #[from] diff --git a/rust/hg-core/src/revlog.rs b/rust/hg-core/src/revlog.rs --- a/rust/hg-core/src/revlog.rs +++ b/rust/hg-core/src/revlog.rs @@ -35,6 +35,9 @@ #[allow(clippy::unreadable_literal)] pub const WORKING_DIRECTORY_REVISION: Revision = 0x7fff; +pub const WORKING_DIRECTORY_HEX: = +""; + /// The simplest expression of what we need of Mercurial DAGs. pub trait Graph { /// Return the two parents of the given `Revision`. To: pulkit, #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
D10253: rhg: add support for detailed exit code for ConfigParseError
pulkit created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This patch adds basic support for detailed exit code to rhg with support for ConfigParseError. For now, if parsing the config results in error, we silently fallbacks to `false`. The python version in this case emits a traceback. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D10253 AFFECTED FILES rust/rhg/src/error.rs rust/rhg/src/exitcode.rs rust/rhg/src/main.rs tests/test-config.t tests/test-dispatch.t CHANGE DETAILS diff --git a/tests/test-dispatch.t b/tests/test-dispatch.t --- a/tests/test-dispatch.t +++ b/tests/test-dispatch.t @@ -90,12 +90,9 @@ $ mkdir -p badrepo/.hg $ echo 'invalid-syntax' > badrepo/.hg/hgrc -TODO: add rhg support for detailed exit codes -#if no-rhg $ hg log -b -Rbadrepo default config error at badrepo/.hg/hgrc:1: invalid-syntax [30] -#endif $ hg log -b --cwd=inexistent default abort: $ENOENT$: 'inexistent' diff --git a/tests/test-config.t b/tests/test-config.t --- a/tests/test-config.t +++ b/tests/test-config.t @@ -3,8 +3,6 @@ Invalid syntax: no value -TODO: add rhg support for detailed exit codes -#if no-rhg $ cat > .hg/hgrc << EOF > novaluekey > EOF @@ -37,7 +35,6 @@ $ hg showconfig config error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace: [section] [30] -#endif Reset hgrc diff --git a/rust/rhg/src/main.rs b/rust/rhg/src/main.rs --- a/rust/rhg/src/main.rs +++ b/rust/rhg/src/main.rs @@ -82,7 +82,14 @@ let blackbox = blackbox::Blackbox::new(, process_start_time)?; blackbox.log_command_start(); let result = run(); -blackbox.log_command_end(exit_code()); +blackbox.log_command_end(exit_code( +, +// TODO: show a warning or combine with original error if `get_bool` +// returns an error +config +.get_bool(b"ui", b"detailed-exit-code") +.unwrap_or(false), +)); result } @@ -114,6 +121,7 @@ error, cwd.display() ))), +false, ) }) }); @@ -125,7 +133,13 @@ // "unsupported" error but that is not enforced by the type system. let on_unsupported = OnUnsupported::Abort; -exit(_current_dir, , on_unsupported, Err(error.into())) +exit( +_current_dir, +, +on_unsupported, +Err(error.into()), +false, +) }); if let Some(repo_path_bytes) = _args.repo { @@ -145,6 +159,11 @@ repo_path_bytes ), }), +// TODO: show a warning or combine with original error if `get_bool` +// returns an error +non_repo_config +.get_bool(b"ui", b"detailed-exit-code") +.unwrap_or(false), ) } } @@ -160,6 +179,11 @@ , OnUnsupported::from_config(, _repo_config), Err(error.into()), +// TODO: show a warning or combine with original error if `get_bool` +// returns an error +non_repo_config +.get_bool(b"ui", b"detailed-exit-code") +.unwrap_or(false), ), }; @@ -176,13 +200,35 @@ repo_result.as_ref(), config, ); -exit(_current_dir, , on_unsupported, result) +exit( +_current_dir, +, +on_unsupported, +result, +// TODO: show a warning or combine with original error if `get_bool` +// returns an error +config +.get_bool(b"ui", b"detailed-exit-code") +.unwrap_or(false), +) } -fn exit_code(result: <(), CommandError>) -> i32 { +fn exit_code( +result: <(), CommandError>, +use_detailed_exit_code: bool, +) -> i32 { match result { Ok(()) => exitcode::OK, -Err(CommandError::Abort { .. }) => exitcode::ABORT, +Err(CommandError::Abort { +message: _, +detailed_exit_code, +}) => { +if use_detailed_exit_code { +*detailed_exit_code +} else { +exitcode::ABORT +} +} Err(CommandError::Unsuccessful) => exitcode::UNSUCCESSFUL, // Exit with a specific code and no error message to let a potential @@ -198,6 +244,7 @@ ui: , mut on_unsupported: OnUnsupported, result: Result<(), CommandError>, +use_detailed_exit_code: bool, ) -> ! { if let ( OnUnsupported::Fallback { executable }, @@ -238,18 +285,22 @@ } } } -exit_no_fallback(ui, on_unsupported, result) +exit_no_fallback(ui, on_unsupported,