[Bug 6648] New: list index out of range when running `hg evolve` on obsolete commit with no successors
https://bz.mercurial-scm.org/show_bug.cgi?id=6648 Bug ID: 6648 Summary: list index out of range when running `hg evolve` on obsolete commit with no successors Product: Mercurial Version: unspecified Hardware: PC OS: Linux Status: UNCONFIRMED Severity: bug Priority: wish Component: evolution Assignee: bugzi...@mercurial-scm.org Reporter: h...@pewpew.net CC: mercurial-devel@mercurial-scm.org, pierre-yves.da...@ens-lyon.org Python Version: --- If I create a chain of commits (let's call this revisions 0-1-2), split 1, prune 2, and then update to 2 and try to run `hg evolve`, it crashes with `list index out of range` as of change 431bf23d. Reproduction steps: ``` $ hg init $ echo hi > foo && hg commit -qAm 'r0' $ echo -e "hi_r3\nhi_r4" >> foo && hg commit -qm 'r1_splitme' $ echo bar > bar && hg commit -qAm 'r2_obsoleteme' # This is just so that we don't have to use --hidden below. $ hg tag --local -r 2 bar $ hg prune -r 2 $ hg split # Split r1_splitme into two revisions, whatever way you want $ hg update -r 2 --hidden 2 files updated, 0 files merged, 0 files removed, 0 files unresolved working directory parent is obsolete! (82259e31ec1f) (use 'hg evolve' to update to its parent successor) # When using evolve from 46858e6f (aka 431bf23d^) $ hg evolve parent is obsolete with multiple successors: 3 75ce52d1 "hi_r3" 4 749ae671 tip "hi_r4" # When using evolve from 431bf23d hg evolve --config extensions.evolve= ** unknown exception encountered, please report by visiting ** https://mercurial-scm.org/wiki/BugTracker ** Python 3.9.9 (main, Jan 12 2022, 16:10:51) [GCC 11.2.0] ** Mercurial Distributed SCM (version 6.0.2+hg355.02e9ad08999b) ** Extensions loaded: evolve 10.5.0.dev Traceback (most recent call last): File "/usr/lib/python3/dist-packages/hgext3rd/evolve/evolvecmd.py", line 1822, in solveobswdp ctx = repo[utility._singlesuccessor(repo, oldctx)] File "/usr/lib/python3/dist-packages/hgext3rd/evolve/utility.py", line 127, in _singlesuccessor raise MultipleSuccessorsError(newer) hgext3rd.evolve.utility.MultipleSuccessorsError: [[b'u\xceR\xd1\xe8#\xb7M\x16\x96YWZz\xb6\xfc*\xbfQ\xb9', b't\x9a\xe6qM>\xcf\xab\x8b\x07\xabD\xfei\xfd=\x00\x1e\x9f\xb0']] During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/bin/hg", line 61, in dispatch.run() File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 144, in run status = dispatch(req) File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 250, in dispatch status = _rundispatch(req) File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 299, in _rundispatch ret = _runcatch(req) or 0 File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 487, in _runcatch return _callcatch(ui, _runcatchfunc) File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 497, in _callcatch return scmutil.callcatch(ui, func) File "/usr/lib/python3/dist-packages/mercurial/scmutil.py", line 153, in callcatch return func() File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 474, in _runcatchfunc return _dispatch(req) File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 1290, in _dispatch return runcommand( File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 935, in runcommand ret = _runcommand(ui, options, cmd, d) File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 1302, in _runcommand return cmdfunc() File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 1288, in d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) File "/usr/lib/python3/dist-packages/mercurial/util.py", line 1887, in check return func(*args, **kwargs) File "/usr/lib/python3/dist-packages/hgext3rd/evolve/evolvecmd.py", line 1638, in evolve return _performevolve(ui, repo, **opts) File "/usr/lib/python3/dist-packages/hgext3rd/evolve/evolvecmd.py", line 1726, in _performevolve result = solveobswdp(ui, repo, opts) File "/usr/lib/python3/dist-packages/hgext3rd/evolve/evolvecmd.py", line 1825, in solveobswdp splitsucc = utility.select_split_successor(ui, repo, oldctx) File "/usr/lib/python3/dist-packages/hgext3rd/evolve/utility.py", line 139, in select_split_successor targets = obsutil.successorssets(repo, ctx.node())[0] IndexError: list index out of range ``` -- 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
D12202: status: fix hg status race against file deletion
aalekseyev 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/D12202 AFFECTED FILES rust/hg-core/src/dirstate_tree/status.rs CHANGE DETAILS diff --git a/rust/hg-core/src/dirstate_tree/status.rs b/rust/hg-core/src/dirstate_tree/status.rs --- a/rust/hg-core/src/dirstate_tree/status.rs +++ b/rust/hg-core/src/dirstate_tree/status.rs @@ -713,7 +713,17 @@ let mut results = Vec::new(); for entry in path.read_dir()? { let entry = entry?; -let metadata = entry.metadata()?; +let metadata = match entry.metadata() { +Ok(v) => v, +Err(e) => { +// race with file deletion? +if e.kind() == std::io::ErrorKind::NotFound { +continue; +} else { +return Err(e); +} +} +}; let name = get_bytes_from_os_string(entry.file_name()); // FIXME don't do this when cached if name == b".hg" { To: aalekseyev, #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 | Failed pipeline for branch/default | a7a90d80
Pipeline #34996 has failed! Project: mercurial-devel ( https://foss.heptapod.net/mercurial/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/mercurial/mercurial-devel/-/commits/branch/default ) Commit: a7a90d80 ( https://foss.heptapod.net/mercurial/mercurial-devel/-/commit/a7a90d80a2077ec7ca4d7faa0099fbb5153f5f60 ) Commit Message: obsolete: don't use os.stat in repo.obsstore.__... Commit Author: Anton Shestakov ( https://foss.heptapod.net/av6 ) Pipeline #34996 ( https://foss.heptapod.net/mercurial/mercurial-devel/-/pipelines/34996 ) triggered by Administrator ( https://foss.heptapod.net/root ) had 2 failed jobs. Job #342169 ( https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/342169/raw ) Stage: tests Name: checks-py3 Job #342168 ( https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/342168/raw ) Stage: tests Name: checks-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
D12201: tracked-key: remove the dual write and rename to tracked-hint
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The dual-write approach was mostly useless. As explained in the previous version of the help, the key had to be read twice before we could cache a value. However this "read twice" limitation actually also apply to any usage of the key. If some operation wants to rely of the "same value == same tracked set" property it would need to read the value before, and after running that operation (or at least, after, in all cases). So it cannot be sure the operation it did is "valid" until checking the key after the operation. As a resultat such operation can only be read-only or rollbackable. This reduce the utility of the "same value == same tracked set" a lot. So it seems simpler to drop the double write and to update the documentation to highlight that this file does not garantee race-free operation. As a result the "key" is demoted to a "hint". Documentation is updated accordingly. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12201 AFFECTED FILES mercurial/configitems.py mercurial/dirstate.py mercurial/helptext/config.txt mercurial/localrepo.py mercurial/requirements.py mercurial/upgrade_utils/actions.py mercurial/upgrade_utils/engine.py tests/test-help.t tests/test-persistent-nodemap.t tests/test-status-tracked-key.t tests/test-upgrade-repo.t CHANGE DETAILS diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t --- a/tests/test-upgrade-repo.t +++ b/tests/test-upgrade-repo.t @@ -214,7 +214,7 @@ format-variant repo fncache:yes dirstate-v2: no - tracked-key: no + tracked-hint:no dotencode: yes generaldelta: yes share-safe: yes @@ -231,7 +231,7 @@ format-variant repo config default fncache:yesyes yes dirstate-v2: no no no - tracked-key: no no no + tracked-hint:no no no dotencode: yesyes yes generaldelta: yesyes yes share-safe: yesyes yes @@ -249,7 +249,7 @@ format-variant repo config default fncache:yes no yes dirstate-v2: no no no - tracked-key: no no no + tracked-hint:no no no dotencode: yes no yes generaldelta: yesyes yes share-safe: yesyes yes @@ -267,7 +267,7 @@ format-variant repo config default [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes] [formatvariant.name.uptodate|dirstate-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] - [formatvariant.name.uptodate|tracked-key: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] + [formatvariant.name.uptodate|tracked-hint: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes] [formatvariant.name.uptodate|generaldelta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes] [formatvariant.name.uptodate|share-safe: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes] @@ -298,7 +298,7 @@ { "config": false, "default": false, -"name": "tracked-key", +"name": "tracked-hint", "repo": false }, { @@ -498,7 +498,7 @@ format-variant repo fncache: no dirstate-v2: no - tracked-key: no + tracked-hint:no dotencode: no generaldelta:no share-safe: no @@ -514,7 +514,7 @@ format-variant repo config default fncache: noyes yes dirstate-v2: no no no - tracked-key: no no no + tracked-hint:no no no dotencode: noyes yes generaldelta:noyes yes share-safe: noyes yes @@ -532,7 +532,7 @@ format-variant repo config default fncache: noyes yes dirstate-v2: no no no - tracked-key: no no no + tracked-hint:no no no dotencode: noyes yes generaldelta:no no yes share-safe: noyes yes @@ -550,7 +550,7 @@ format-variant repo config default
D12200: tracked-file: rename the format option to use `use-`
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This is more consistent with the other options. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12200 AFFECTED FILES mercurial/configitems.py mercurial/helptext/config.txt mercurial/localrepo.py tests/test-help.t tests/test-status-tracked-key.t CHANGE DETAILS diff --git a/tests/test-status-tracked-key.t b/tests/test-status-tracked-key.t --- a/tests/test-status-tracked-key.t +++ b/tests/test-status-tracked-key.t @@ -9,7 +9,7 @@ $ cat << EOF >> $HGRCPATH > [format] - > dirstate-tracked-key=yes + > use-dirstate-tracked-key=yes > EOF $ hg init tracked-key-test @@ -172,7 +172,7 @@ downgrade - $ hg debugupgraderepo --config format.dirstate-tracked-key=no --run --quiet + $ hg debugupgraderepo --config format.use-dirstate-tracked-key=no --run --quiet upgrade will perform the following actions: requirements @@ -189,7 +189,7 @@ upgrade - $ hg debugupgraderepo --config format.dirstate-tracked-key=yes --run --quiet + $ hg debugupgraderepo --config format.use-dirstate-tracked-key=yes --run --quiet upgrade will perform the following actions: requirements diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -1599,7 +1599,7 @@ "use-dirstate-v2" - "dirstate-tracked-key" + "use-dirstate-tracked-key" "use-persistent-nodemap" diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -3695,10 +3695,10 @@ else: requirements.add(requirementsmod.SHARED_REQUIREMENT) -if ui.configbool(b'format', b'dirstate-tracked-key'): -version = ui.configint(b'format', b'dirstate-tracked-key.version') +if ui.configbool(b'format', b'use-dirstate-tracked-key'): +version = ui.configint(b'format', b'use-dirstate-tracked-key.version') msg = _("ignoring unknown tracked key version: %d\n") -hint = _("see `hg help config.format.exp-dirstate-tracked-key-version") +hint = _("see `hg help config.format.use-dirstate-tracked-key-version") if version != 1: ui.warn(msg % version, hint=hint) else: diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt --- a/mercurial/helptext/config.txt +++ b/mercurial/helptext/config.txt @@ -944,7 +944,7 @@ For a more comprehensive guide, see :hg:`help internals.dirstate-v2`. -``dirstate-tracked-key`` +``use-dirstate-tracked-key`` Enable or disable the writing of "tracked key" file alongside the dirstate. (default to disabled) diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -1279,13 +1279,13 @@ ) coreconfigitem( b'format', -b'dirstate-tracked-key', +b'use-dirstate-tracked-key', default=False, experimental=True, ) coreconfigitem( b'format', -b'dirstate-tracked-key.version', +b'use-dirstate-tracked-key.version', default=1, experimental=True, ) To: marmoute, #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
D12198: tracked-key: make it possible to upgrade to and downgrade from the feature
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This seems rather important if we want people to start using it. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12198 AFFECTED FILES mercurial/dirstate.py mercurial/upgrade_utils/actions.py mercurial/upgrade_utils/engine.py tests/test-persistent-nodemap.t tests/test-status-tracked-key.t tests/test-upgrade-repo.t CHANGE DETAILS diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t --- a/tests/test-upgrade-repo.t +++ b/tests/test-upgrade-repo.t @@ -214,6 +214,7 @@ format-variant repo fncache:yes dirstate-v2: no + tracked-key: no dotencode: yes generaldelta: yes share-safe: yes @@ -230,6 +231,7 @@ format-variant repo config default fncache:yesyes yes dirstate-v2: no no no + tracked-key: no no no dotencode: yesyes yes generaldelta: yesyes yes share-safe: yesyes yes @@ -247,6 +249,7 @@ format-variant repo config default fncache:yes no yes dirstate-v2: no no no + tracked-key: no no no dotencode: yes no yes generaldelta: yesyes yes share-safe: yesyes yes @@ -264,6 +267,7 @@ format-variant repo config default [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes] [formatvariant.name.uptodate|dirstate-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] + [formatvariant.name.uptodate|tracked-key: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes] [formatvariant.name.uptodate|generaldelta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes] [formatvariant.name.uptodate|share-safe: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes] @@ -292,6 +296,12 @@ "repo": false }, { +"config": false, +"default": false, +"name": "tracked-key", +"repo": false + }, + { "config": true, "default": true, "name": "dotencode", @@ -488,6 +498,7 @@ format-variant repo fncache: no dirstate-v2: no + tracked-key: no dotencode: no generaldelta:no share-safe: no @@ -503,6 +514,7 @@ format-variant repo config default fncache: noyes yes dirstate-v2: no no no + tracked-key: no no no dotencode: noyes yes generaldelta:noyes yes share-safe: noyes yes @@ -520,6 +532,7 @@ format-variant repo config default fncache: noyes yes dirstate-v2: no no no + tracked-key: no no no dotencode: noyes yes generaldelta:no no yes share-safe: noyes yes @@ -537,6 +550,7 @@ format-variant repo config default [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes] [formatvariant.name.uptodate|dirstate-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] + [formatvariant.name.uptodate|tracked-key: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes] [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes] [formatvariant.name.mismatchconfig|share-safe: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes] @@ -1588,6 +1602,7 @@ format-variant repo config default fncache:yesyes yes dirstate-v2: no no no + tracked-key: no no no dotencode: yesyes yes generaldelta: yesyes yes share-safe: yesyes yes @@ -1631,6
D12199: tracked-key: update the requirement value
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY We renamed the config option but we forgot to change the actual value… REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12199 AFFECTED FILES mercurial/requirements.py tests/test-status-tracked-key.t CHANGE DETAILS diff --git a/tests/test-status-tracked-key.t b/tests/test-status-tracked-key.t --- a/tests/test-status-tracked-key.t +++ b/tests/test-status-tracked-key.t @@ -168,7 +168,7 @@ $ ls .hg/dirstate-tracked-key .hg/dirstate-tracked-key $ hg debugrequires | grep 'tracked' - exp-dirstate-tracked-key-v1 + dirstate-tracked-key-v1 downgrade @@ -177,7 +177,7 @@ requirements preserved: * (glob) - removed: exp-dirstate-tracked-key-v1 + removed: dirstate-tracked-key-v1 no revlogs to process @@ -194,11 +194,11 @@ requirements preserved: * (glob) - added: exp-dirstate-tracked-key-v1 + added: dirstate-tracked-key-v1 no revlogs to process $ ls -1 .hg/dirstate-tracked-key .hg/dirstate-tracked-key $ hg debugrequires | grep 'tracked' - exp-dirstate-tracked-key-v1 + dirstate-tracked-key-v1 diff --git a/mercurial/requirements.py b/mercurial/requirements.py --- a/mercurial/requirements.py +++ b/mercurial/requirements.py @@ -18,7 +18,7 @@ STORE_REQUIREMENT = b'store' FNCACHE_REQUIREMENT = b'fncache' -DIRSTATE_TRACKED_KEY_V1 = b'exp-dirstate-tracked-key-v1' +DIRSTATE_TRACKED_KEY_V1 = b'dirstate-tracked-key-v1' DIRSTATE_V2_REQUIREMENT = b'dirstate-v2' # When narrowing is finalized and no longer subject to format changes, To: marmoute, #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