Mercurial > evolve
changeset 6936:a239ea1dfacb default tip
branching: merge with stable
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Fri, 22 Nov 2024 16:53:42 +0400 |
parents | 361dcfcb3f08 (current diff) 954d7ea5cd67 (diff) |
children | |
files | .gitlab-ci.yml MANIFEST.in hgext3rd/topic/stack.py tests/test-check-sdist.t tests/test-topic-issue6406.t tests/test-topic.t |
diffstat | 15 files changed, 223 insertions(+), 79 deletions(-) [+] |
line wrap: on
line diff
--- a/.gitlab-ci.yml Sat Oct 26 11:19:50 2024 +0400 +++ b/.gitlab-ci.yml Fri Nov 22 16:53:42 2024 +0400 @@ -30,7 +30,7 @@ script: - *prepare_hg - ($PYTHON --version) - - (cd tests; set -x; HGMODULEPOLICY="$TEST_HGMODULEPOLICY" $PYTHON /ci/repos/mercurial/tests/run-tests.py --color=always $RUNTEST_ARGS) + - (cd tests; set -x; HGMODULEPOLICY="$TEST_HGMODULEPOLICY" $PYTHON /ci/repos/mercurial/tests/run-tests.py --color=always --blacklist blacklists/compat-branches $RUNTEST_ARGS) checks-py3: <<: *runtests @@ -99,7 +99,7 @@ echo testing with mercurial branch="$hg_branch", revision="$hg_rev"' - Invoke-Expression "$Env:PYTHON --version" - echo "$Env:RUNTEST_ARGS" - - C:/MinGW/msys/1.0/bin/sh.exe --login -c 'cd "$OLDPWD" && HGMODULEPOLICY="$TEST_HGMODULEPOLICY" $PYTHON C:/Temp/hg/tests/run-tests.py --color=always $RUNTEST_ARGS' + - C:/MinGW/msys/1.0/bin/sh.exe --login -c 'cd "$OLDPWD" && HGMODULEPOLICY="$TEST_HGMODULEPOLICY" $PYTHON C:/Temp/hg/tests/run-tests.py --blacklist tests/blacklists/compat-branches --color=always $RUNTEST_ARGS' windows-py3: <<: *windows_runtests
--- a/MANIFEST.in Sat Oct 26 11:19:50 2024 +0400 +++ b/MANIFEST.in Fri Nov 22 16:53:42 2024 +0400 @@ -27,3 +27,4 @@ prune debian prune .gitlab prune hgext3rd/evolve/hack +prune tests/blacklists
--- a/hgext3rd/evolve/obscache.py Sat Oct 26 11:19:50 2024 +0400 +++ b/hgext3rd/evolve/obscache.py Fri Nov 22 16:53:42 2024 +0400 @@ -14,6 +14,7 @@ from mercurial import ( localrepo, obsolete, + obsutil, phases, node, util, @@ -462,12 +463,45 @@ isobs = obscache.get return frozenset(r for r in notpublic if isobs(r)) +def _computecontentdivergentset(repo): + """the set of rev that compete to be the final successors of some revision.""" + divergent = set() + obsstore = repo.obsstore + newermap = {} + tonode = repo.changelog.node + candidates = sorted(obsolete._mutablerevs(repo) - obsolete.getrevs(repo, b"obsolete")) + for rev in candidates: + node = tonode(rev) + mark = obsstore.predecessors.get(node, ()) + toprocess = set(mark) + seen = set() + while toprocess: + prec = toprocess.pop()[0] + if prec in seen: + continue # emergency cycle hanging prevention + seen.add(prec) + if prec not in newermap: + obsutil.successorssets(repo, prec, cache=newermap) + newer = [n for n in newermap[prec] if n] + # only this condition was changed in hg 6.9 + # hg <= 6.8 (e68fe567a780) + if len(newer) > 1 and any(n for n in newer if node not in n): + divergent.add(rev) + break + toprocess.update(obsstore.predecessors.get(prec, ())) + return frozenset(divergent) + @eh.uisetup def cachefuncs(ui): orig = obsolete.cachefuncs[b'obsolete'] wrapped = lambda repo: _computeobsoleteset(orig, repo) obsolete.cachefuncs[b'obsolete'] = wrapped + if util.versiontuple(n=3) < (6, 8, 2): + # e68fe567a780 was just before the 6.8.2 release + # hg <= 6.8 (e68fe567a780) + obsolete.cachefuncs[b'contentdivergent'] = _computecontentdivergentset + @eh.reposetup def setupcache(ui, repo):
--- a/hgext3rd/evolve/obsdiscovery.py Sat Oct 26 11:19:50 2024 +0400 +++ b/hgext3rd/evolve/obsdiscovery.py Fri Nov 22 16:53:42 2024 +0400 @@ -323,8 +323,14 @@ return affected_nodes -# if there is that many new obsmarkers, reset without analysing them +def _chunks(items, size=1024): + for i in range(0, len(items), size): + yield items[i:i + size] + +# reset when there are this many new obsmarkers or affected changesets RESET_ABOVE = 10000 +# reset when there are this many affected ranges +RESET_ABOVE_RANGES = RESET_ABOVE * 10 class _obshashcache(obscache.dualsourcecache): @@ -432,6 +438,14 @@ # always reset for now, the code detecting affect is buggy # so we need to reset more broadly than we would like. try: + if reset: + ranges = [] # no need to compute that + else: + ranges = repo.stablerange.contains(repo, affected) + if RESET_ABOVE_RANGES < len(ranges): + repo.ui.log(b'evoext-cache', b'obshashcache reset - ' + b'too many ranges to purges\n') + reset = True if repo.stablerange._con is None: repo.ui.log(b'evoext-cache', b'obshashcache reset - ' b'underlying stablerange cache unavailable\n') @@ -441,9 +455,10 @@ self._data.clear() else: ranges = repo.stablerange.contains(repo, affected) - con.executemany(_delete, ranges) - for r in ranges: - self._data.pop(r, None) + for chunk in _chunks(ranges): + con.executemany(_delete, chunk) + for r in chunk: + self._data.pop(r, None) except (sqlite3.DatabaseError, sqlite3.OperationalError) as exc: repo.ui.log(b'evoext-cache', b'error while updating obshashrange cache: %s\n'
--- a/hgext3rd/topic/stack.py Sat Oct 26 11:19:50 2024 +0400 +++ b/hgext3rd/topic/stack.py Fri Nov 22 16:53:42 2024 +0400 @@ -181,7 +181,11 @@ pt1 = self._repo[b'.'] if pt1.obsolete(): - pt1 = self._repo[_singlesuccessor(self._repo, pt1)] + try: + pt1 = self._repo[_singlesuccessor(self._repo, pt1)] + except MultipleSuccessorsError as e: + # here, taking a random successor is better than failing + pt1 = self._repo[e.successorssets[0][-1]] revs.insert(0, pt1.rev()) return revs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/blacklists/compat-branches Fri Nov 22 16:53:42 2024 +0400 @@ -0,0 +1,6 @@ +# This file is used on compatibility branches to skip tests that for one reason +# or another are not applicable or simply incompatible with older versions of +# Mercurial. +# +# On default and stable branch this file should not list any test files. It's +# only supposed to be populated on compability branches.
--- a/tests/test-amend.t Sat Oct 26 11:19:50 2024 +0400 +++ b/tests/test-amend.t Fri Nov 22 16:53:42 2024 +0400 @@ -131,6 +131,7 @@ setting the user after we have performed the test with no username $ HGUSER=test +#if hg69 Check the help $ hg amend -h hg amend [OPTION]... [FILE]... @@ -139,18 +140,18 @@ combine a changeset with updates and replace it with a new one - Commits a new changeset incorporating both the changes to the given files - and all the changes from the current parent changeset into the repository. + Commits a new changeset incorporating both the changes to the given files and + all the changes from the current parent changeset into the repository. - See 'hg commit' for details about committing changes. + See 'hg commit' for details about committing changes. - If you don't specify -m, the parent's message will be reused. + If you don't specify -m, the parent's message will be reused. - If --extract is specified, the behavior of 'hg amend' is reversed: Changes - to selected files in the checked out revision appear again as uncommitted - changed in the working directory. + If --extract is specified, the behavior of 'hg amend' is reversed: Changes to + selected files in the checked out revision appear again as uncommitted changed + in the working directory. - Returns 0 on success, 1 if nothing changed. + Returns 0 on success, 1 if nothing changed. options ([+] can be repeated): @@ -175,6 +176,7 @@ -i --interactive use interactive mode (some details hidden, use --verbose to show complete help) +#endif Check that we abort if --patch and --extract both are used at once $ hg amend --patch --extract
--- a/tests/test-check-sdist.t Sat Oct 26 11:19:50 2024 +0400 +++ b/tests/test-check-sdist.t Fri Nov 22 16:53:42 2024 +0400 @@ -29,6 +29,7 @@ no previously-included directories found matching 'contrib' no previously-included directories found matching 'debian' no previously-included directories found matching '.gitlab' + no previously-included directories found matching 'tests/blacklists' $ cd "$TESTTMP"/dist $ find hg?evolve-*.tar.gz -size +800000c @@ -104,6 +105,8 @@ hgext3rd/evolve/hack hgext3rd/evolve/hack/__init__.py hgext3rd/evolve/hack/drophack.py + tests/blacklists + tests/blacklists/compat-branches tests/test-drop.t #endif
--- a/tests/test-evolve-templates.t Sat Oct 26 11:19:50 2024 +0400 +++ b/tests/test-evolve-templates.t Fri Nov 22 16:53:42 2024 +0400 @@ -1424,7 +1424,7 @@ working directory parent is obsolete! (4a004186e638) (use 'hg evolve' to update to its successor: b18bc8331526) $ hg commit --amend -m "Add B only" - 4 new content-divergent changesets + 2 new content-divergent changesets $ hg log -G @ changeset: 9:0b997eb7ceee @@ -1445,7 +1445,7 @@ | * changeset: 7:ba2ed02b0c9a | | user: test | | date: Thu Jan 01 00:00:00 1970 +0000 - | | instability: orphan, content-divergent + | | instability: orphan | | summary: Add A,B,C | | | x changeset: 6:4a004186e638 @@ -1455,11 +1455,10 @@ | obsolete: reworded using amend as 9:0b997eb7ceee | summary: Add A,B,C | - * changeset: 5:dd800401bd8c + o changeset: 5:dd800401bd8c | parent: 3:f897c6137566 | user: test | date: Thu Jan 01 00:00:00 1970 +0000 - | instability: content-divergent | summary: Add A,B,C | o changeset: 3:f897c6137566 @@ -1495,7 +1494,7 @@ | Fate: reworded using amend as 8:b18bc8331526 | Fate: reworded using amend as 9:0b997eb7ceee | - * dd800401bd8c + o dd800401bd8c | o f897c6137566 | @@ -1513,7 +1512,7 @@ | x 4a004186e638 |/ Obsfate: reworded using amend as 8:b18bc8331526; reworded using amend as 9:0b997eb7ceee | - * dd800401bd8c + o dd800401bd8c | o f897c6137566 | @@ -1544,7 +1543,7 @@ | Fate: reworded using amend as 9:0b997eb7ceee | Origin: split from 4:9bd10a0775e4 | - * dd800401bd8c + o dd800401bd8c | Predecessors: 4:9bd10a0775e4 | semi-colon: 4:9bd10a0775e4 | Origin: split from 4:9bd10a0775e4 @@ -1592,7 +1591,7 @@ |/ Obsfate: reworded using amend as 8:b18bc8331526; reworded using amend as 9:0b997eb7ceee | Obsorigin: split from 4:9bd10a0775e4 | - * dd800401bd8c + o dd800401bd8c | Obsorigin: split from 4:9bd10a0775e4 | | x 9bd10a0775e4 @@ -1620,7 +1619,7 @@ $ hg rebase -r 7 -d 8 --config extensions.rebase= rebasing 7:ba2ed02b0c9a "Add A,B,C" $ hg tlog - * eceed8f98ffc + o eceed8f98ffc | Predecessors: 4:9bd10a0775e4 | semi-colon: 4:9bd10a0775e4 | Origin: rewritten using rebase from 4:9bd10a0775e4 @@ -1635,7 +1634,7 @@ | semi-colon: 4:9bd10a0775e4 | Origin: rewritten using amend from 4:9bd10a0775e4 | - * dd800401bd8c + o dd800401bd8c | Predecessors: 4:9bd10a0775e4 | semi-colon: 4:9bd10a0775e4 | Origin: split from 4:9bd10a0775e4 @@ -1651,7 +1650,7 @@ o ea207398892e $ hg fateoriginlog - * eceed8f98ffc + o eceed8f98ffc | Obsorigin: rewritten using rebase from 4:9bd10a0775e4 | | * 0b997eb7ceee @@ -1660,7 +1659,7 @@ * | b18bc8331526 |/ Obsorigin: rewritten using amend from 4:9bd10a0775e4 | - * dd800401bd8c + o dd800401bd8c | Obsorigin: split from 4:9bd10a0775e4 | | @ 9bd10a0775e4
--- a/tests/test-fixup.t Sat Oct 26 11:19:50 2024 +0400 +++ b/tests/test-fixup.t Fri Nov 22 16:53:42 2024 +0400 @@ -12,6 +12,7 @@ > git = 1 > EOF +#if hg69 $ hg help fixup hg fixup [OPTION]... [-r] REV @@ -19,22 +20,22 @@ add working directory changes to an arbitrary revision - A new changeset will be created, superseding the one specified. The new - changeset will combine working directory changes with the changes in the - target revision. + A new changeset will be created, superseding the one specified. The new + changeset will combine working directory changes with the changes in the + target revision. - This operation requires the working directory changes to be relocated onto - the target revision, which might result in merge conflicts. + This operation requires the working directory changes to be relocated onto the + target revision, which might result in merge conflicts. - If fixup is interrupted to manually resolve a conflict, it can be - continued with --continue/-c, or aborted with --abort. + If fixup is interrupted to manually resolve a conflict, it can be continued + with --continue/-c, or aborted with --abort. - Note that this command is fairly new and its behavior is still - experimental. For example, the working copy will be left on a temporary, - obsolete commit containing the fixed-up changes after the operation. This - might change in the future. + Note that this command is fairly new and its behavior is still experimental. + For example, the working copy will be left on a temporary, obsolete commit + containing the fixed-up changes after the operation. This might change in the + future. - Returns 0 on success, 1 if nothing changed. + Returns 0 on success, 1 if nothing changed. options: @@ -43,6 +44,7 @@ --abort abort an interrupted fixup (some details hidden, use --verbose to show complete help) +#endif Simple cases ------------
--- a/tests/test-pick.t Sat Oct 26 11:19:50 2024 +0400 +++ b/tests/test-pick.t Fri Nov 22 16:53:42 2024 +0400 @@ -25,15 +25,15 @@ $ hg init repo $ cd repo - $ hg help pick + $ hg help pick | sed 's/^ //' hg pick [OPTION]... [-r] REV aliases: grab move a commit onto the working directory parent and update to it. - The resulting changeset will have the current active topic. If there's no - active topic set, the resulting changeset will also not have any topic. + The resulting changeset will have the current active topic. If there's no + active topic set, the resulting changeset will also not have any topic. options:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-stack-split-s0.t Fri Nov 22 16:53:42 2024 +0400 @@ -0,0 +1,70 @@ +Testing the case when s0 is obsolete, and has multiple successors that are +topological heads + + $ . "$TESTDIR/testlib/common.sh" + + $ cat << EOF >> "$HGRCPATH" + > [extensions] + > evolve = + > topic = + > EOF + + $ hg init split-s0 + $ cd split-s0 + + $ mkcommit ROOT + $ mkcommit A + +creating a small stack for the experiment + + $ hg branch cool-stack + marked working directory as branch cool-stack + (branches are permanent and global, did you want a bookmark?) + $ mkcommit J + $ mkcommit K + $ mkcommit L + +right now everything is stable, including s0 + + $ hg stack + ### target: cool-stack (branch) + s3@ L (current) + s2: K + s1: J + s0^ A (base) + +destabilize the stack by obsoleting s0 with 2 successors + + $ hg up 'desc(ROOT)' -q + $ mkcommit X + created new head + (consider using topic for lightweight branches. See 'hg help topic') + $ hg up 'desc(ROOT)' -q + $ mkcommit Y + created new head + (consider using topic for lightweight branches. See 'hg help topic') + + $ hg --config extensions.evolve= prune --split --rev 'desc(A)' \ + > --successor 'desc(X)' --successor 'desc(Y)' + 1 changesets pruned + 3 new orphan changesets + +the 2 successors are 2 different heads (the revset is taken from _singlesuccessor function) + + $ hg log -r 'heads((desc(X)+desc(Y))::(desc(X)+desc(Y)))' -GT '{desc}\n' + @ Y + | + ~ + o X + | + ~ + +we choose one of the successors for s0, this is better than failing to show the stack at all + + $ hg up 'desc(L)' -q + $ hg stack + ### target: cool-stack (branch) + s3@ L (current orphan) + s2$ K (orphan) + s1$ J (orphan) + s0^ Y (base)
--- a/tests/test-topic-issue6406.t Sat Oct 26 11:19:50 2024 +0400 +++ b/tests/test-topic-issue6406.t Fri Nov 22 16:53:42 2024 +0400 @@ -53,9 +53,9 @@ This is what the help text says about this issue - $ hg help pick | grep 'active topic' - The resulting changeset will have the current active topic. If there's no - active topic set, the resulting changeset will also not have any topic. + $ hg help pick | grep 'active topic' | sed 's/^ //' + The resulting changeset will have the current active topic. If there's no + active topic set, the resulting changeset will also not have any topic. wdir has no active topic: pick should clear topic of the resulting cset
--- a/tests/test-topic.t Sat Oct 26 11:19:50 2024 +0400 +++ b/tests/test-topic.t Fri Nov 22 16:53:42 2024 +0400 @@ -171,45 +171,47 @@ stack list all changesets in a topic and other information (use 'hg help -v topic' to show built-in aliases and global options) + +#if hg69 $ hg help topics hg topics [OPTION]... [-r REV]... [TOPIC] View current topic, set current topic, change topic for a set of revisions, or see all topics. - Clear topic on existing topiced revisions: + Clear topic on existing topiced revisions: - hg topics --rev <related revset> --clear + hg topics --rev <related revset> --clear - Change topic on some revisions: + Change topic on some revisions: - hg topics <newtopicname> --rev <related revset> + hg topics <newtopicname> --rev <related revset> - Clear current topic: + Clear current topic: - hg topics --clear + hg topics --clear - Set current topic: + Set current topic: - hg topics <topicname> + hg topics <topicname> - List of topics: + List of topics: - hg topics + hg topics - List of topics sorted according to their last touched time displaying last - touched time and the user who last touched the topic: + List of topics sorted according to their last touched time displaying last + touched time and the user who last touched the topic: - hg topics --age + hg topics --age - The active topic (if any) will be prepended with a "*". + The active topic (if any) will be prepended with a "*". - The '--current' flag helps to take active topic into account. For example, - if you want to set the topic on all the draft changesets to the active - topic, you can do: 'hg topics -r "draft()" --current' + The '--current' flag helps to take active topic into account. For example, if + you want to set the topic on all the draft changesets to the active topic, you + can do: 'hg topics -r "draft()" --current' - The --verbose version of this command display various information on the - state of each topic. + The --verbose version of this command display various information on the state + of each topic. options ([+] can be repeated): @@ -221,6 +223,8 @@ -T --template TEMPLATE display with template (some details hidden, use --verbose to show complete help) +#endif + $ hg topics Test topics interaction with evolution:
--- a/tests/test-tutorial.t Sat Oct 26 11:19:50 2024 +0400 +++ b/tests/test-tutorial.t Fri Nov 22 16:53:42 2024 +0400 @@ -910,24 +910,25 @@ This part is not written yet, but you can use either the `histedit` extension or the `uncommit` command to split a change. +#if hg69 $ hg help uncommit hg uncommit [OPTION]... [FILE]... move changes from parent revision to working directory - Changes to selected files in the checked out revision appear again as - uncommitted changed in the working directory. A new revision without the - selected changes is created, becomes the checked out revision, and - obsoletes the previous one. + Changes to selected files in the checked out revision appear again as + uncommitted changed in the working directory. A new revision without the + selected changes is created, becomes the checked out revision, and obsoletes + the previous one. - The --include option specifies patterns to uncommit. The --exclude option - specifies patterns to keep in the commit. + The --include option specifies patterns to uncommit. The --exclude option + specifies patterns to keep in the commit. - The --rev argument let you change the commit file to a content of another - revision. It still does not change the content of your file in the working - directory. + The --rev argument let you change the commit file to a content of another + revision. It still does not change the content of your file in the working + directory. - Return 0 if changed files are uncommitted. + Return 0 if changed files are uncommitted. options ([+] can be repeated): @@ -945,6 +946,7 @@ -U --current-user record the current user as committer (some details hidden, use --verbose to show complete help) +#endif The edit command of histedit can be used to split changeset: @@ -955,6 +957,7 @@ The tutorial part is not written yet but can use `hg fold`: +#if hg69 $ hg help fold hg fold [OPTION]... [-r] REV... @@ -962,12 +965,12 @@ fold multiple revisions into a single one - With --from, folds all the revisions linearly between the given revisions - and the parent of the working directory. + With --from, folds all the revisions linearly between the given revisions and + the parent of the working directory. - With --exact, folds only the specified revisions while ignoring the parent - of the working directory. In this case, the given revisions must form a - linear unbroken chain. + With --exact, folds only the specified revisions while ignoring the parent of + the working directory. In this case, the given revisions must form a linear + unbroken chain. options ([+] can be repeated): @@ -983,6 +986,7 @@ -U --current-user record the current user as committer (some details hidden, use --verbose to show complete help) +#endif -----------------------