D9723: ci: avoid a global before_script definition
danchr created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This removes the implicit assumption that all jobs are test runs. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9723 AFFECTED FILES contrib/heptapod-ci.yml CHANGE DETAILS diff --git a/contrib/heptapod-ci.yml b/contrib/heptapod-ci.yml --- a/contrib/heptapod-ci.yml +++ b/contrib/heptapod-ci.yml @@ -4,22 +4,21 @@ image: registry.heptapod.net/mercurial/ci-images/mercurial-core -# The runner made a clone as root. -# We make a new clone owned by user used to run the step. -before_script: -- hg clone . /tmp/mercurial-ci/ --noupdate --config phases.publish=no -- hg -R /tmp/mercurial-ci/ update `hg log --rev '.' --template '{node}'` -- cd /tmp/mercurial-ci/rust/rhg -- cargo build -- cd /tmp/mercurial-ci/ -- ls -1 tests/test-check-*.* > /tmp/check-tests.txt - variables: PYTHON: python TEST_HGMODULEPOLICY: "allow" .runtests_template: &runtests stage: tests +# The runner made a clone as root. +# We make a new clone owned by user used to run the step. +before_script: + - hg clone . /tmp/mercurial-ci/ --noupdate --config phases.publish=no + - hg -R /tmp/mercurial-ci/ update `hg log --rev '.' --template '{node}'` + - cd /tmp/mercurial-ci/rust/rhg + - cargo build + - cd /tmp/mercurial-ci/ + - ls -1 tests/test-check-*.* > /tmp/check-tests.txt script: - echo "python used, $PYTHON" - echo "$RUNTEST_ARGS" To: danchr, #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
D9722: setup: don't import distutils prior to checking FORCE_SETUPTOOLS
danchr created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY I've seen warnings about importing distutils before setuptools, although I can't reproduce them at the moment. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9722 AFFECTED FILES setup.py CHANGE DETAILS diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -179,7 +179,6 @@ import re import shutil import tempfile -from distutils import log # We have issues with setuptools on some platforms and builders. Until # those are resolved, setuptools is opt-in except for platforms where @@ -200,6 +199,7 @@ from distutils.command.install_data import install_data from distutils.command.install_lib import install_lib from distutils.command.install_scripts import install_scripts +from distutils import log from distutils.spawn import spawn, find_executable from distutils import file_util from distutils.errors import ( To: danchr, #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
D9724: ci: build python wheels
danchr created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The wheels are merely attached to the job as artifacts. We could upload them to Heptapod or PyPI, but that's left for a possible followup. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9724 AFFECTED FILES contrib/heptapod-ci.yml CHANGE DETAILS diff --git a/contrib/heptapod-ci.yml b/contrib/heptapod-ci.yml --- a/contrib/heptapod-ci.yml +++ b/contrib/heptapod-ci.yml @@ -1,5 +1,6 @@ stages: - tests + - packages - phabricator image: registry.heptapod.net/mercurial/ci-images/mercurial-core @@ -120,3 +121,42 @@ PYTHON: python3 RUNTEST_ARGS: "--blacklist /tmp/check-tests.txt --chg" TEST_HGMODULEPOLICY: "c" + +build-wheels-x86: +stage: packages +image: quay.io/pypa/${PLATFORM} +script: +- yum install -y gettext +- | +for pythondir in /opt/python/* +do +$pythondir/bin/pip install docutils pygments +$pythondir/bin/pip wheel --no-binary :all: -w wheelhouse/ . +done +- | +for whl in wheelhouse/*-linux_*.whl +do +auditwheel repair --plat "$PLATFORM" $whl +done +- rm -v wheelhouse/*-linux_*.whl +- mv -v wheelhouse/*.whl . +artifacts: +paths: +- "*.whl" +parallel: +matrix: +- PLATFORM: +- manylinux1_i686 +- manylinux2010_i686 +# - manylinux2010_x86_64 +- manylinux2014_i686 +- manylinux2014_x86_64 + +build-wheels-arm: +extends: build-wheels-x86 +tags: +- arm64 +parallel: +matrix: +- PLATFORM: +- manylinux2014_aarch64 To: danchr, #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
D9725: ci: generate and report XML test results
danchr 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/D9725 AFFECTED FILES contrib/heptapod-ci.yml CHANGE DETAILS diff --git a/contrib/heptapod-ci.yml b/contrib/heptapod-ci.yml --- a/contrib/heptapod-ci.yml +++ b/contrib/heptapod-ci.yml @@ -23,7 +23,16 @@ script: - echo "python used, $PYTHON" - echo "$RUNTEST_ARGS" -- HGMODULEPOLICY="$TEST_HGMODULEPOLICY" "$PYTHON" tests/run-tests.py --color=always $RUNTEST_ARGS +- > + HGMODULEPOLICY="$TEST_HGMODULEPOLICY" + "$PYTHON" tests/run-tests.py + --outputdir ${CI_PROJECT_DIR} + --color=always + --xunit ${CI_PROJECT_DIR}/${CI_JOB_ID}.xml + $RUNTEST_ARGS +artifacts: +reports: +junit: ${CI_JOB_ID}.xml checks-py2: <<: *runtests To: danchr, #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
D9726: ci: use parallel matrices
danchr 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/D9726 AFFECTED FILES contrib/heptapod-ci.yml CHANGE DETAILS diff --git a/contrib/heptapod-ci.yml b/contrib/heptapod-ci.yml --- a/contrib/heptapod-ci.yml +++ b/contrib/heptapod-ci.yml @@ -9,7 +9,7 @@ PYTHON: python TEST_HGMODULEPOLICY: "allow" -.runtests_template: &runtests +.runtests_template: stage: tests # The runner made a clone as root. # We make a new clone owned by user used to run the step. @@ -34,102 +34,56 @@ reports: junit: ${CI_JOB_ID}.xml -checks-py2: -<<: *runtests +checks: +extends: .runtests_template variables: RUNTEST_ARGS: "--time --test-list /tmp/check-tests.txt" +parallel: +matrix: +- PYTHON: [python2, python3] -checks-py3: -<<: *runtests -variables: -RUNTEST_ARGS: "--time --test-list /tmp/check-tests.txt" -PYTHON: python3 - -rust-cargo-test-py2: &rust_cargo_test +rust-cargo-test: stage: tests script: - echo "python used, $PYTHON" - make rust-tests - -rust-cargo-test-py3: -stage: tests -<<: *rust_cargo_test -variables: -PYTHON: python3 +parallel: +matrix: +- PYTHON: [python2, python3] +- {PYTHON: [python3], HG_RUST_FEATURES: [dirstate-tree]} phabricator-refresh: stage: phabricator script: - "./contrib/phab-refresh-stack.sh --comment \":white_check_mark: refresh by Heptapod after a successful CI run (:octopus: :green_heart:)\"" -rust-cargo-test-py3-dirstate-tree: -<<: *rust_cargo_test -variables: -PYTHON: python3 -HG_RUST_FEATURES: dirstate-tree - -test-py2: -<<: *runtests -variables: -RUNTEST_ARGS: " --no-rust --blacklist /tmp/check-tests.txt" -TEST_HGMODULEPOLICY: "c" - -test-py3: -<<: *runtests +test: +extends: .runtests_template variables: RUNTEST_ARGS: " --no-rust --blacklist /tmp/check-tests.txt" -PYTHON: python3 -TEST_HGMODULEPOLICY: "c" - -test-py2-pure: -<<: *runtests -variables: -RUNTEST_ARGS: "--pure --blacklist /tmp/check-tests.txt" -TEST_HGMODULEPOLICY: "py" - -test-py3-pure: -<<: *runtests -variables: -RUNTEST_ARGS: "--pure --blacklist /tmp/check-tests.txt" -PYTHON: python3 -TEST_HGMODULEPOLICY: "py" - -test-py2-rust: -<<: *runtests -variables: -HGWITHRUSTEXT: cpython -RUNTEST_ARGS: "--rust --blacklist /tmp/check-tests.txt" -TEST_HGMODULEPOLICY: "rust+c" - -test-py3-rust: -<<: *runtests -variables: -HGWITHRUSTEXT: cpython -RUNTEST_ARGS: "--rust --blacklist /tmp/check-tests.txt" -PYTHON: python3 -TEST_HGMODULEPOLICY: "rust+c" - -test-py3-rust-dirstate-tree: -<<: *runtests -variables: -HGWITHRUSTEXT: cpython -RUNTEST_ARGS: "--rust --blacklist /tmp/check-tests.txt" -PYTHON: python3 -TEST_HGMODULEPOLICY: "rust+c" -HG_RUST_FEATURES: "dirstate-tree" - -test-py2-chg: -<<: *runtests -variables: -RUNTEST_ARGS: "--blacklist /tmp/check-tests.txt --chg" -TEST_HGMODULEPOLICY: "c" - -test-py3-chg: -<<: *runtests -variables: -PYTHON: python3 -RUNTEST_ARGS: "--blacklist /tmp/check-tests.txt --chg" -TEST_HGMODULEPOLICY: "c" +parallel: +matrix: +- PYTHON: +- python2 +- python3 + TEST_HGMODULEPOLICY: +- c +- py +- PYTHON: +- python2 +- python3 + RUNTEST_ARGS: +- " --no-rust --blacklist /tmp/check-tests.txt --chg" +- PYTHON: +- python2 +- python3 + TEST_HGMODULEPOLICY: +- rust+c + HGWITHRUSTEXT: +- cpython + HG_RUST_FEATURES: +- dirstate-tree +- "" build-wheels-x86: stage: packages To: danchr, #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
D9727: ci: report status to phabricator on failures
danchr 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/D9727 AFFECTED FILES contrib/heptapod-ci.yml CHANGE DETAILS diff --git a/contrib/heptapod-ci.yml b/contrib/heptapod-ci.yml --- a/contrib/heptapod-ci.yml +++ b/contrib/heptapod-ci.yml @@ -1,7 +1,6 @@ stages: - tests - packages - - phabricator image: registry.heptapod.net/mercurial/ci-images/mercurial-core @@ -52,10 +51,27 @@ - PYTHON: [python2, python3] - {PYTHON: [python3], HG_RUST_FEATURES: [dirstate-tree]} -phabricator-refresh: -stage: phabricator +phabricator-success: +stage: .post +when: on_success script: - - "./contrib/phab-refresh-stack.sh --comment \":white_check_mark: refresh by Heptapod after a successful CI run (:octopus: :green_heart:)\"" + - > + ./contrib/phab-refresh-stack.sh + --comment ":white_check_mark: refresh by + Heptapod after a successful CI run (:octopus: :green_heart:) + \n\n + ${CI_PIPELINE_URL}" + +phabricator-failure: +stage: .post +when: on_failure +script: + - > + ./contrib/phab-refresh-stack.sh + --comment ":negative_squared_cross_mark: refresh by + Heptapod after a failed CI run (:octopus: :heart:) + \n\n + ${CI_PIPELINE_URL}" test: extends: .runtests_template To: danchr, #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
[Bug 6464] New: largefiles.usercache configuration option is not documented
https://bz.mercurial-scm.org/show_bug.cgi?id=6464 Bug ID: 6464 Summary: largefiles.usercache configuration option is not documented Product: Mercurial Version: unspecified Hardware: PC OS: Linux Status: UNCONFIRMED Severity: bug Priority: wish Component: largefiles Assignee: bugzi...@mercurial-scm.org Reporter: djer...@cfa.harvard.edu CC: mercurial-devel@mercurial-scm.org, nato...@gmail.com Python Version: --- The largefiles.usercache configuration option is not documented either via hg help -e largefiles or in the manual page. -- 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
[Bug 6465] New: Provide option to not use largefiles usercache
https://bz.mercurial-scm.org/show_bug.cgi?id=6465 Bug ID: 6465 Summary: Provide option to not use largefiles usercache Product: Mercurial Version: unspecified Hardware: PC OS: Linux Status: UNCONFIRMED Severity: feature Priority: wish Component: largefiles Assignee: bugzi...@mercurial-scm.org Reporter: djer...@cfa.harvard.edu CC: mercurial-devel@mercurial-scm.org, nato...@gmail.com Python Version: --- I work on a network where most disks (including /home) are remotely mounted via NFS (NetApp). Largefiles will copy files to the usercache if it cannot link them, which causes significant network i/o if the usercache is on an NFS mount. I have repositories on multiple remote disks, so to efficiently use Largefiles I'd have to specify a different, disk-specific largefiles.usercache value for each repo. This is, as you can imagine, painful, and leads to some frustration. It would be very useful if I could simply turn the usercache functionality off. If I find a need to use it for a particular repository, I can simply turn it on there. Thanks! -- 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
D9728: rhg: use a release-mode executable in tests
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This allows the rhg build for test-rhg.t to share compiled dependencies such as hg-core with the hg-cpython build for other tests. For context, my wrapper script for the typical edit-compile-test cycle now looks like this: (cd rust && cargo +nightly-2020-10-04 fmt) (cd rust && cargo build --release -p rhg) make --silent local PURE=--rust python test/run-tests.py --local "$@" REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9728 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 @@ -2,8 +2,8 @@ Define an rhg function that will only run if rhg exists $ rhg() { - > if [ -f "$RUNTESTDIR/../rust/target/debug/rhg" ]; then - > "$RUNTESTDIR/../rust/target/debug/rhg" "$@" + > if [ -f "$RUNTESTDIR/../rust/target/release/rhg" ]; then + > "$RUNTESTDIR/../rust/target/release/rhg" "$@" > else > echo "skipped: Cannot find rhg. Try to run cargo build in rust/rhg." > exit 80 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
D9729: patch: handle filenames with trailing spaces
spectral created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY I have no idea if this is *actually* supported by the patch file format, but at least when reading from a patch file created by running `hg shelve`, it is written out such that there's a trailing space after the second (`b`) filename. When we read the patch file, we remove the space before parsing the filenames, so it doesn't end up matching the other sources of what files are in the shelve. We observed this internally due to a wrapper around unshelve that called into patch.changedfiles, but `hg patch` is able to reproduce the issue as well, so I've included both tests. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9729 AFFECTED FILES mercurial/patch.py tests/test-shelve.t CHANGE DETAILS diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -1512,3 +1512,26 @@ $ hg unshelve -i --keep abort: --keep on --interactive is not yet supported [255] + + $ hg update -q --clean . + +Test that we can successfully shelve and unshelve a file with a trailing space +in the filename. Such filenames are supposedly unsupported on Windows, so we +wrap it in the no-windows check. Also test `hg patch` of the .patch file +produced by `hg shelve`. +#if no-windows + $ echo hi > 'my filename ' + $ hg add 'my filename ' + warning: filename ends with ' ', which is not allowed on Windows: 'my filename ' + $ hg shelve + shelved as default-01 + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ cp .hg/shelved/default-01.patch test_patch.patch + $ hg unshelve + unshelving change 'default-01' + $ cat 'my filename ' + hi + $ hg update -q --clean . + $ hg patch -p1 test_patch.patch + applying test_patch.patch +#endif diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -393,7 +393,7 @@ gp = None gitpatches = [] for line in lr: -line = line.rstrip(b' \r\n') +line = line.rstrip(b'\r\n') if line.startswith(b'diff --git a/'): m = gitre.match(line) if m: @@ -2073,7 +2073,7 @@ yield b'file', (afile, bfile, h, gp and gp.copy() or None) yield b'hunk', h elif x.startswith(b'diff --git a/'): -m = gitre.match(x.rstrip(b' \r\n')) +m = gitre.match(x.rstrip(b'\r\n')) if not m: continue if gitpatches is None: To: spectral, #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@46203: new changeset
New changeset in mercurial: https://www.mercurial-scm.org/repo/hg/rev/63f0e31af0e5 changeset: 46203:63f0e31af0e5 bookmark:@ tag: tip parent: 46202:5135b393884b parent: 46147:b308d750de82 user:Augie Fackler date:Mon Jan 11 14:10:31 2021 -0500 summary: merge with stable -- 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
[RFC] Perfect hash table plan
Hello all, I've been looking at different indexing methods for use in different parts of store and cache. One technique that I had part of the code base around already is the generation of perfect hash tables. The plan can be found in the Wiki: https://www.mercurial-scm.org/wiki/PhashPlan The proof of concept doesn't include the generator as I've been too lazy so far to port that code, but a small x86_64 Linux binary is included with the Python glue around it for testing. The test case is the exact matching for nodes to revision and I've outlined how the prefix matching could be implemented as well. Joerg ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9732: persistent-nodemap: test that is it present after a clone
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The persistent nodemap is actually missing after local and stream clone. We start by adding a test ffor the case that works so that we can compare output after the fix. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9732 AFFECTED FILES tests/test-persistent-nodemap.t CHANGE DETAILS diff --git a/tests/test-persistent-nodemap.t b/tests/test-persistent-nodemap.t --- a/tests/test-persistent-nodemap.t +++ b/tests/test-persistent-nodemap.t @@ -575,3 +575,28 @@ data-length: 121088 data-unused: 0 data-unused: 0.000% + +Persistent nodemap and local/streaming clone + + + $ cd .. + +standard clone +-- + +The persistent nodemap should exist after a streaming clone + + $ hg clone --pull --quiet -U test-repo standard-clone + $ ls -1 standard-clone/.hg/store/ | egrep '00(changelog|manifest)(\.n|-.*\.nd)' + 00changelog-*.nd (glob) + 00changelog.n + 00manifest-*.nd (glob) + 00manifest.n + $ hg -R standard-clone debugnodemap --metadata + uid: * (glob) + tip-rev: 5005 + tip-node: 90d5d3ba2fc47db50f712570487cb261a68c8ffe + data-length: 121088 + data-unused: 0 + data-unused: 0.000% + 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
D9733: persistent-nodemap: test it (does not) exist after a local clone
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This is currently buggy. We add a test before fixing the bug. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9733 AFFECTED FILES tests/test-persistent-nodemap.t CHANGE DETAILS diff --git a/tests/test-persistent-nodemap.t b/tests/test-persistent-nodemap.t --- a/tests/test-persistent-nodemap.t +++ b/tests/test-persistent-nodemap.t @@ -600,3 +600,13 @@ data-unused: 0 data-unused: 0.000% + +local clone + + +The persistent nodemap should exist after a streaming clone + + $ hg clone -U test-repo local-clone + $ ls -1 local-clone/.hg/store/ | egrep '00(changelog|manifest)(\.n|-.*\.nd)' + [1] + $ hg -R local-clone debugnodemap --metadata 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
D9731: narrow: overwrite readfast in excludeddirmanifestctx
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The excludeddirmanifestctx does not have underlying storage (because it is excluded) so the implementation of the `readfast` trying to access it crash. This was reveled while running some cache warning code on narrow repositories. That code will be introduced further down in the series. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9731 AFFECTED FILES mercurial/manifest.py CHANGE DETAILS diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -2297,6 +2297,10 @@ def read(self): return excludeddir(self._dir, self._node) +def readfast(self, shallow=False): +# special version of readfast since we don't have underlying storage +return self.read() + def write(self, *args): raise error.ProgrammingError( b'attempt to write manifest from excluded dir %s' % self._dir 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
D9734: persistent-nodemap: test it (does not) exist after a stream clone
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This is currently buggy. We add a test before fixing the bug. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9734 AFFECTED FILES tests/test-persistent-nodemap.t CHANGE DETAILS diff --git a/tests/test-persistent-nodemap.t b/tests/test-persistent-nodemap.t --- a/tests/test-persistent-nodemap.t +++ b/tests/test-persistent-nodemap.t @@ -610,3 +610,13 @@ $ ls -1 local-clone/.hg/store/ | egrep '00(changelog|manifest)(\.n|-.*\.nd)' [1] $ hg -R local-clone debugnodemap --metadata + +stream clone + + +The persistent nodemap should exist after a streaming clone + + $ hg clone -U --stream --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/test-repo stream-clone --quiet + $ ls -1 stream-clone/.hg/store/ | egrep '00(changelog|manifest)(\.n|-.*\.nd)' + [1] + $ hg -R stream-clone debugnodemap --metadata 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
D9736: persistent-nodemap: highlight that node is not sent when streaming
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY We have a local work-around, however having that data sent in the first place would be better. So we start with a test that monitor what is sent, and notice they are not. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9736 AFFECTED FILES tests/test-persistent-nodemap.t CHANGE DETAILS diff --git a/tests/test-persistent-nodemap.t b/tests/test-persistent-nodemap.t --- a/tests/test-persistent-nodemap.t +++ b/tests/test-persistent-nodemap.t @@ -625,7 +625,11 @@ The persistent nodemap should exist after a streaming clone - $ hg clone -U --stream --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/test-repo stream-clone --quiet + $ hg clone -U --stream --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/test-repo stream-clone --debug | egrep '00(changelog|manifest)' + adding [s] 00manifest.i (313 KB) + adding [s] 00manifest.d (452 KB) + adding [s] 00changelog.i (313 KB) + adding [s] 00changelog.d (360 KB) $ ls -1 stream-clone/.hg/store/ | egrep '00(changelog|manifest)(\.n|-.*\.nd)' 00changelog-*.nd (glob) 00changelog.n 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
D9730: test: replace a many occurence of `python` with `$PYTHON`
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Otherwise this can use the wrong python version, or worse, not find any python at all. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9730 AFFECTED FILES tests/library-infinitepush.sh tests/remotefilelog-library.sh tests/test-demandimport.py tests/test-infinitepush-ci.t tests/test-nointerrupt.t tests/test-remotefilelog-cacheprocess.t tests/test-update-atomic.t tests/test-verify-repo-operations.py CHANGE DETAILS diff --git a/tests/test-verify-repo-operations.py b/tests/test-verify-repo-operations.py --- a/tests/test-verify-repo-operations.py +++ b/tests/test-verify-repo-operations.py @@ -11,7 +11,9 @@ import sys # Only run if slow tests are allowed -if subprocess.call(['python', '%s/hghave' % os.environ['TESTDIR'], 'slow']): +if subprocess.call( +[os.environ['PYTHON'], '%s/hghave' % os.environ['TESTDIR'], 'slow'] +): sys.exit(80) # These tests require Hypothesis and pytz to be installed. @@ -352,7 +354,7 @@ o.write(content) self.log.append( ( -"$ python -c 'import binascii; " +"$ $PYTHON -c 'import binascii; " "print(binascii.unhexlify(\"%s\"))' > %s" ) % ( diff --git a/tests/test-update-atomic.t b/tests/test-update-atomic.t --- a/tests/test-update-atomic.t +++ b/tests/test-update-atomic.t @@ -54,7 +54,7 @@ $ hg update -r 1 --config extensions.showwrites=.hg/showwrites.py 2>&1 | grep "a1'.*wb" ('vfs open', ('a1', 'wb'), [('atomictemp', False), ('backgroundclose', True)]) - $ python $TESTTMP/show_mode.py * + $ $PYTHON $TESTTMP/show_mode.py * a1:0644 a2:0755 b1:0644 @@ -76,7 +76,7 @@ $ hg update -r 1 6 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ python $TESTTMP/show_mode.py * + $ $PYTHON $TESTTMP/show_mode.py * a1:0644 a2:0755 b1:0644 @@ -88,7 +88,7 @@ $ chmod a-w ro - $ python $TESTTMP/show_mode.py ro + $ $PYTHON $TESTTMP/show_mode.py ro ro:0444 Now the file is present, try to update and check the permissions of the file @@ -96,7 +96,7 @@ $ hg up -r 2 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ python $TESTTMP/show_mode.py ro + $ $PYTHON $TESTTMP/show_mode.py ro ro:0644 # The file which was read-only is now writable in the default behavior @@ -121,7 +121,7 @@ C ro Check the file permission after update - $ python $TESTTMP/show_mode.py * + $ $PYTHON $TESTTMP/show_mode.py * a1:0644 a2:0755 b1:0644 @@ -133,7 +133,7 @@ $ chmod a-w ro - $ python $TESTTMP/show_mode.py ro + $ $PYTHON $TESTTMP/show_mode.py ro ro:0444 Now the file is present, try to update and check the permissions of the file @@ -141,7 +141,7 @@ $ hg update -r 2 --traceback 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ python $TESTTMP/show_mode.py ro + $ $PYTHON $TESTTMP/show_mode.py ro ro:0644 # The behavior is the same as without atomic update diff --git a/tests/test-remotefilelog-cacheprocess.t b/tests/test-remotefilelog-cacheprocess.t --- a/tests/test-remotefilelog-cacheprocess.t +++ b/tests/test-remotefilelog-cacheprocess.t @@ -66,7 +66,7 @@ $ cat >> $HGRCPATH < [remotefilelog] - > cacheprocess = python $TESTTMP/cacheprocess-logger.py + > cacheprocess = $PYTHON $TESTTMP/cacheprocess-logger.py > EOF Test cache keys and cache misses. diff --git a/tests/test-nointerrupt.t b/tests/test-nointerrupt.t --- a/tests/test-nointerrupt.t +++ b/tests/test-nointerrupt.t @@ -59,7 +59,7 @@ > EOF Test ctrl-c - $ python $TESTTMP/timeout.py -s INT 1 hg sleep 2 + $ $PYTHON $TESTTMP/timeout.py -s INT 1 hg sleep 2 interrupted! [124] @@ -68,7 +68,7 @@ > nointerrupt = yes > EOF - $ python $TESTTMP/timeout.py -s INT 1 hg sleep 2 + $ $PYTHON $TESTTMP/timeout.py -s INT 1 hg sleep 2 interrupted! [124] @@ -77,7 +77,7 @@ > nointerrupt-interactiveonly = False > EOF - $ python $TESTTMP/timeout.py -s INT 1 hg sleep 2 + $ $PYTHON $TESTTMP/timeout.py -s INT 1 hg sleep 2 shutting down cleanly press ^C again to terminate immediately (dangerous) end of unsafe operation diff --git a/tests/test-infinitepush-ci.t b/tests/test-infinitepush-ci.t --- a/tests/test-infinitepush-ci.t +++ b/tests/test-infinitepush-ci.t @@ -10,7 +10,7 @@ $ . "$TESTDIR/library-infinitepush.sh" $ cat >> $HGRCPATH < [ui] - > ssh = python "$TESTDIR/dummyssh" + > ssh = $PYTHON "$TESTDIR/dummyssh" > [alias] > glog = log -GT "{rev}:{node|short} {desc}\n{phase}" > EOF diff --git a/tests/test-demandimport.py b/tests/test-demandimport.py --- a/tests/test-demandimport.py +++ b/tests/test-demandimport.py @@ -14,7 +14,7 @@ # Only run if demandimport is allowed if subprocess.call( -['python', '%s/hghave' %
D9735: clone: make sure we warm the cache after a clone
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This work around any deviciency/limitation of the clone process. In our case this ensure the persistent nodemap exist with valid content. Ideally, the cloning process would also do "the right thing". However since older server will never be able to do "the right thing". The local workaround will be necessary anyway. I am not worried by the performance impact of this as `hg clone` is non-instant on large repositories where is could matters. Warming the cache if they are already correct is very fast. And if they are not already warm, this seems like a good time to do so. This impact various test as more cache are now warmed sooner, all the change should be harmless. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9735 AFFECTED FILES mercurial/hg.py tests/test-acl.t tests/test-blackbox.t tests/test-clone-uncompressed.t tests/test-clone.t tests/test-clonebundles.t tests/test-empty.t tests/test-eol-clone.t tests/test-hardlinks.t tests/test-lfs-serve-access.t tests/test-persistent-nodemap.t tests/test-share.t tests/test-ssh.t tests/test-stream-bundle-v2.t tests/test-tags.t tests/test-treemanifest.t tests/test-wireproto-exchangev2.t CHANGE DETAILS diff --git a/tests/test-wireproto-exchangev2.t b/tests/test-wireproto-exchangev2.t --- a/tests/test-wireproto-exchangev2.t +++ b/tests/test-wireproto-exchangev2.t @@ -111,6 +111,7 @@ } updating the branch cache new changesets 3390ef850073:caa2a465451d (3 drafts) + updating the branch cache (sent 5 HTTP requests and * bytes; received * bytes in responses) (glob) $ cat clone-output | grep "received frame" @@ -239,6 +240,7 @@ } updating the branch cache new changesets 3390ef850073:4432d83626e8 + updating the branch cache (sent 6 HTTP requests and * bytes; received * bytes in responses) (glob) $ cat clone-output | grep "received frame" @@ -557,6 +559,7 @@ } updating the branch cache new changesets 3390ef850073:caa2a465451d (1 drafts) + updating the branch cache (sent 5 HTTP requests and * bytes; received * bytes in responses) (glob) $ cat clone-output | grep "received frame" @@ -758,6 +761,7 @@ } updating the branch cache new changesets 3390ef850073:97765fc3cd62 + updating the branch cache (sent 5 HTTP requests and * bytes; received * bytes in responses) (glob) $ cat clone-output | grep "received frame" @@ -872,6 +876,7 @@ } updating the branch cache new changesets 3390ef850073:97765fc3cd62 + updating the branch cache (sent 5 HTTP requests and * bytes; received * bytes in responses) (glob) $ cat clone-output | grep "received frame" @@ -988,6 +993,7 @@ } updating the branch cache new changesets 3390ef850073:97765fc3cd62 + updating the branch cache (sent 5 HTTP requests and * bytes; received * bytes in responses) (glob) $ cat clone-output | grep "received frame" @@ -1087,6 +1093,7 @@ } ] } + updating the branch cache (sent 5 HTTP requests and * bytes; received * bytes in responses) (glob) $ cat clone-output | grep "received frame" @@ -1183,6 +1190,7 @@ } ] } + updating the branch cache (sent 5 HTTP requests and * bytes; received * bytes in responses) (glob) $ cat clone-output | grep "received frame" diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t --- a/tests/test-treemanifest.t +++ b/tests/test-treemanifest.t @@ -792,7 +792,7 @@ $ hg clone --config experimental.changegroup3=True --stream -U \ > http://localhost:$HGPORT1 stream-clone-basicstore streaming all changes - 21 files to transfer, * of data (glob) + 29 files to transfer, * of data (glob) transferred * in * seconds (*) (glob) $ hg -R stream-clone-basicstore verify checking changesets @@ -806,7 +806,7 @@ $ hg clone --config experimental.changegroup3=True --stream -U \ > http://localhost:$HGPORT2 stream-clone-encodedstore streaming all changes - 21 files to transfer, * of data (glob) + 29 files to transfer, * of data (glob) transferred * in * seconds (*) (glob) $ hg -R stream-clone-encodedstore verify checking changesets diff --git a/tests/test-tags.t b/tests/test-tags.t --- a/tests/test-tags.t +++ b/tests/test-tags.t @@ -721,19 +721,26 @@ $ ls tagsclient/.hg/cache branch2-base + branch2-immutable + branch2-served + branch2-served.hidden + branch2-visible + branch2-visible-hidden hgtagsfnodes1 rbc-names-v1 rbc-revs-v1 + tags2 + tags2-served Cache should contain the head only, even though other nodes have tags data $ f --size --hexdump tagsclient/.hg/cache/hgtagsfnodes1 tagsclient/.hg/cache/hgtagsfnodes1: size=96 - : ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff || - 0010: ff ff ff ff ff ff ff ff ff
D9737: shelve: use listdir() instead of readdir() when we don't need stat information
martinvonz 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/D9737 AFFECTED FILES mercurial/shelve.py CHANGE DETAILS diff --git a/mercurial/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -617,14 +617,14 @@ def listshelves(repo): """return all shelves in repo as list of (time, name)""" try: -names = repo.vfs.readdir(shelvedir) +names = repo.vfs.listdir(shelvedir) except OSError as err: if err.errno != errno.ENOENT: raise return [] info = [] seen = set() -for (filename, _type) in names: +for filename in names: name = filename.rsplit(b'.', 1)[0] if name in seen: continue To: martinvonz, #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
D9738: shelve: replace repo instance in Shelf class by vfs instance
martinvonz created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY I'd like to be able to teach the `Shelf` class to read shelves from `.hg/shelve-backup/` in addition to `.hg/shelved/`. That means that we'll have to pass in a vfs instead of the repo, so this patch does that preparation. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9738 AFFECTED FILES mercurial/shelve.py CHANGE DETAILS diff --git a/mercurial/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -80,11 +80,13 @@ differences and lets you work with the shelf as a whole. """ -def __init__(self, repo, name): -self.repo = repo +def __init__(self, vfs, name): +self.vfs = vfs self.name = name -self.vfs = vfsmod.vfs(repo.vfs.join(shelvedir)) -self.backupvfs = vfsmod.vfs(repo.vfs.join(backupdir)) + +@staticmethod +def open(repo, name): +return Shelf(vfsmod.vfs(repo.vfs.join(shelvedir)), name) def exists(self): return self.vfs.exists( @@ -105,8 +107,8 @@ self.vfs, self.name + b'.shelve' ).read() -def writebundle(self, bases, node): -cgversion = changegroup.safeversion(self.repo) +def writebundle(self, repo, bases, node): +cgversion = changegroup.safeversion(repo) if cgversion == b'01': btype = b'HG10BZ' compression = None @@ -114,7 +116,7 @@ btype = b'HG20' compression = b'BZ' -repo = self.repo.unfiltered() +repo = repo.unfiltered() outgoing = discovery.outgoing( repo, missingroots=bases, ancestorsof=[node] @@ -123,7 +125,7 @@ bundle_filename = self.vfs.join(self.name + b'.hg') bundle2.writebundle( -self.repo.ui, +repo.ui, cg, bundle_filename, btype, @@ -131,27 +133,27 @@ compression=compression, ) -def applybundle(self, tr): +def applybundle(self, repo, tr): filename = self.name + b'.hg' fp = self.vfs(filename) try: targetphase = phases.internal -if not phases.supportinternal(self.repo): +if not phases.supportinternal(repo): targetphase = phases.secret -gen = exchange.readbundle(self.repo.ui, fp, filename, self.vfs) -pretip = self.repo[b'tip'] +gen = exchange.readbundle(repo.ui, fp, filename, self.vfs) +pretip = repo[b'tip'] bundle2.applybundle( -self.repo, +repo, gen, tr, source=b'unshelve', url=b'bundle:' + self.vfs.join(filename), targetphase=targetphase, ) -shelvectx = self.repo[b'tip'] +shelvectx = repo[b'tip'] if pretip == shelvectx: shelverev = tr.changes[b'revduplicates'][-1] -shelvectx = self.repo[shelverev] +shelvectx = repo[shelverev] return shelvectx finally: fp.close() @@ -159,7 +161,7 @@ def open_patch(self, mode=b'rb'): return self.vfs(self.name + b'.patch', mode) -def _backupfilename(self, filename): +def _backupfilename(self, backupvfs, filename): def gennames(base): yield base base, ext = base.rsplit(b'.', 1) @@ -167,17 +169,18 @@ yield b'%s-%d.%s' % (base, i, ext) for n in gennames(filename): -if not self.backupvfs.exists(n): -return self.backupvfs.join(n) +if not backupvfs.exists(n): +return backupvfs.join(n) -def movetobackup(self): -if not self.backupvfs.isdir(): -self.backupvfs.makedir() +def movetobackup(self, backupvfs): +if not backupvfs.isdir(): +backupvfs.makedir() for suffix in shelvefileextensions: filename = self.name + b'.' + suffix if self.vfs.exists(filename): util.rename( -self.vfs.join(filename), self._backupfilename(filename) +self.vfs.join(filename), +self._backupfilename(backupvfs, filename), ) @@ -375,7 +378,7 @@ label = label.replace(b'.', b'_', 1) if name: -if Shelf(repo, name).exists(): +if Shelf.open(repo, name).exists(): e = _(b"a shelved change named '%s' already exists") % name raise error.Abort(e) @@ -389,7 +392,7 @@ else: for n in gennames(): -if not Shelf(repo, n).exists(): +if not Shelf.open(repo, n).exists(): name = n break @@ -465,10 +468,10
D9739: shelve: make listshelves() list shelves in a given vfs
martinvonz 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/D9739 AFFECTED FILES mercurial/shelve.py CHANGE DETAILS diff --git a/mercurial/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -597,9 +597,10 @@ """subcommand that deletes all shelves""" with repo.wlock(): +vfs = vfsmod.vfs(repo.vfs.join(shelvedir)) backupvfs = vfsmod.vfs(repo.vfs.join(backupdir)) -for _mtime, name in listshelves(repo): -Shelf.open(repo, name).movetobackup(backupvfs) +for _mtime, name in listshelves(vfs): +Shelf(vfs, name).movetobackup(backupvfs) cleanupoldbackups(repo) @@ -619,10 +620,10 @@ cleanupoldbackups(repo) -def listshelves(repo): +def listshelves(vfs): """return all shelves in repo as list of (time, name)""" try: -names = repo.vfs.listdir(shelvedir) +names = vfs.listdir() except OSError as err: if err.errno != errno.ENOENT: raise @@ -634,7 +635,7 @@ if name in seen: continue seen.add(name) -shelf = Shelf.open(repo, name) +shelf = Shelf(vfs, name) if not shelf.exists(): continue mtime = shelf.mtime() @@ -650,7 +651,8 @@ width = ui.termwidth() namelabel = b'shelve.newest' ui.pager(b'shelve') -for mtime, name in listshelves(repo): +vfs = vfsmod.vfs(repo.vfs.join(shelvedir)) +for mtime, name in listshelves(vfs): if pats and name not in pats: continue ui.write(name, label=namelabel) @@ -691,7 +693,8 @@ def patchcmds(ui, repo, pats, opts): """subcommand that displays shelves""" if len(pats) == 0: -shelves = listshelves(repo) +vfs = vfsmod.vfs(repo.vfs.join(shelvedir)) +shelves = listshelves(vfs) if not shelves: raise error.Abort(_(b"there are no shelves to show")) mtime, name = shelves[0] @@ -,7 +1114,8 @@ elif len(shelved) > 1: raise error.InputError(_(b'can only unshelve one change at a time')) elif not shelved: -shelved = listshelves(repo) +vfs = vfsmod.vfs(repo.vfs.join(shelvedir)) +shelved = listshelves(vfs) if not shelved: raise error.StateError(_(b'no shelved changes to apply!')) basename = shelved[0][1] To: martinvonz, #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
D9740: shelve: use listshelves() in cleanupoldbackups()
martinvonz created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY With this patch, there are no more assumptions outside the `Shelf` class about which files (`.patch`, `.hg`, `.shelve`) make up a shelf. As such, this finishes the preparations for making phase-based shelve (perhaps optionally) not write the `.patch` and `.hg` files. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9740 AFFECTED FILES mercurial/shelve.py CHANGE DETAILS diff --git a/mercurial/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -325,19 +325,17 @@ def cleanupoldbackups(repo): vfs = vfsmod.vfs(repo.vfs.join(backupdir)) maxbackups = repo.ui.configint(b'shelve', b'maxbackups') -hgfiles = [f for f in vfs.listdir() if f.endswith(b'.' + patchextension)] -hgfiles = sorted([(vfs.stat(f)[stat.ST_MTIME], f) for f in hgfiles]) +hgfiles = listshelves(vfs) if maxbackups > 0 and maxbackups < len(hgfiles): -bordermtime = hgfiles[-maxbackups][0] +bordermtime = hgfiles[maxbackups - 1][0] else: bordermtime = None -for mtime, f in hgfiles[: len(hgfiles) - maxbackups]: +for mtime, name in hgfiles[maxbackups:]: if mtime == bordermtime: # keep it, because timestamp can't decide exact order of backups continue -base = f[: -(1 + len(patchextension))] for ext in shelvefileextensions: -vfs.tryunlink(base + b'.' + ext) +vfs.tryunlink(name + b'.' + ext) def _backupactivebookmark(repo): To: martinvonz, #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
D9741: shelve: inline ".patch" constant now that it's only used in the Shelf class
martinvonz 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/D9741 AFFECTED FILES mercurial/shelve.py CHANGE DETAILS diff --git a/mercurial/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -64,8 +64,6 @@ backupdir = b'shelve-backup' shelvedir = b'shelved' shelvefileextensions = [b'hg', b'patch', b'shelve'] -# universal extension is present in all types of shelves -patchextension = b'patch' # we never need the user, so we use a # generic user for all shelve operations @@ -89,12 +87,12 @@ return Shelf(vfsmod.vfs(repo.vfs.join(shelvedir)), name) def exists(self): -return self.vfs.exists( -self.name + b'.' + patchextension -) and self.vfs.exists(self.name + b'.hg') +return self.vfs.exists(self.name + b'.patch') and self.vfs.exists( +self.name + b'.hg' +) def mtime(self): -return self.vfs.stat(self.name + b'.' + patchextension)[stat.ST_MTIME] +return self.vfs.stat(self.name + b'.patch')[stat.ST_MTIME] def writeinfo(self, info): scmutil.simplekeyvaluefile(self.vfs, self.name + b'.shelve').write(info) To: martinvonz, #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
D9742: shelve: add a method for deleting shelf to new shelf class
martinvonz created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This is not necessary for my future changes, but it's more consistent to encapsulate the knowledge of the various files in the `Shelf` class. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9742 AFFECTED FILES mercurial/shelve.py CHANGE DETAILS diff --git a/mercurial/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -86,6 +86,10 @@ def open(repo, name): return Shelf(vfsmod.vfs(repo.vfs.join(shelvedir)), name) +@staticmethod +def open_backup(repo, name): +return Shelf(vfsmod.vfs(repo.vfs.join(backupdir)), name) + def exists(self): return self.vfs.exists(self.name + b'.patch') and self.vfs.exists( self.name + b'.hg' @@ -181,6 +185,10 @@ self._backupfilename(backupvfs, filename), ) +def delete(self): +for ext in shelvefileextensions: +self.vfs.tryunlink(self.name + b'.' + ext) + class shelvedstate(object): """Handle persistence during unshelving operations. @@ -332,8 +340,7 @@ if mtime == bordermtime: # keep it, because timestamp can't decide exact order of backups continue -for ext in shelvefileextensions: -vfs.tryunlink(name + b'.' + ext) +Shelf.open_backup(repo, name).delete() def _backupactivebookmark(repo): To: martinvonz, #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
D9743: shelve: also create class representing whole directory of shelves
martinvonz created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY It's a little annoying to have to create and pass in a vfs into `listshelves()`. This patch attempts to start addressing that by creating a class that represents a directory containing shelves (the directory can be either `.hg/shelved/` or `.hg/shelve-backup/`). REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9743 AFFECTED FILES mercurial/shelve.py CHANGE DETAILS diff --git a/mercurial/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -70,6 +70,17 @@ shelveuser = b'shelve@localhost' +class ShelfDir(object): +def __init__(self, repo, for_backups=False): +if for_backups: +self.vfs = vfsmod.vfs(repo.vfs.join(backupdir)) +else: +self.vfs = vfsmod.vfs(repo.vfs.join(shelvedir)) + +def get(self, name): +return Shelf(self.vfs, name) + + class Shelf(object): """Represents a shelf, including possibly multiple files storing it. @@ -82,14 +93,6 @@ self.vfs = vfs self.name = name -@staticmethod -def open(repo, name): -return Shelf(vfsmod.vfs(repo.vfs.join(shelvedir)), name) - -@staticmethod -def open_backup(repo, name): -return Shelf(vfsmod.vfs(repo.vfs.join(backupdir)), name) - def exists(self): return self.vfs.exists(self.name + b'.patch') and self.vfs.exists( self.name + b'.hg' @@ -381,7 +384,7 @@ label = label.replace(b'.', b'_', 1) if name: -if Shelf.open(repo, name).exists(): +if ShelfDir(repo).get(name).exists(): e = _(b"a shelved change named '%s' already exists") % name raise error.Abort(e) @@ -394,8 +397,9 @@ raise error.Abort(_(b"shelved change names can not start with '.'")) else: +shelf_dir = ShelfDir(repo) for n in gennames(): -if not Shelf.open(repo, n).exists(): +if not shelf_dir.get(n).exists(): name = n break @@ -471,7 +475,7 @@ def _shelvecreatedcommit(repo, node, name, match): info = {b'node': hex(node)} -shelf = Shelf.open(repo, name) +shelf = ShelfDir(repo).get(name) shelf.writeinfo(info) bases = list(mutableancestors(repo[node])) shelf.writebundle(repo, bases, node) @@ -614,7 +618,7 @@ with repo.wlock(): backupvfs = vfsmod.vfs(repo.vfs.join(backupdir)) for name in pats: -shelf = Shelf.open(repo, name) +shelf = ShelfDir(repo).get(name) if not shelf.exists(): raise error.InputError( _(b"shelved change '%s' not found") % name @@ -655,6 +659,7 @@ namelabel = b'shelve.newest' ui.pager(b'shelve') vfs = vfsmod.vfs(repo.vfs.join(shelvedir)) +shelf_dir = ShelfDir(repo) for mtime, name in listshelves(vfs): if pats and name not in pats: continue @@ -670,7 +675,7 @@ ui.write(age, label=b'shelve.age') ui.write(b' ' * (12 - len(age))) used += 12 -with Shelf.open(repo, name).open_patch() as fp: +with shelf_dir.get(name).open_patch() as fp: while True: line = fp.readline() if not line: @@ -703,8 +708,9 @@ mtime, name = shelves[0] pats = [name] +shelf_dir = ShelfDir(repo) for shelfname in pats: -if not Shelf.open(repo, shelfname).exists(): +if not shelf_dir.get(shelfname).exists(): raise error.Abort(_(b"cannot find shelf %s") % shelfname) listcmd(ui, repo, pats, opts) @@ -796,7 +802,7 @@ """remove related files after an unshelve""" if not opts.get(b'keep'): backupvfs = vfsmod.vfs(repo.vfs.join(backupdir)) -Shelf.open(repo, name).movetobackup(backupvfs) +ShelfDir(repo).get(name).movetobackup(backupvfs) cleanupoldbackups(repo) @@ -896,7 +902,7 @@ """Recreate commit in the repository during the unshelve""" repo = repo.unfiltered() node = None -shelf = Shelf.open(repo, basename) +shelf = ShelfDir(repo).get(basename) if shelf.hasinfo(): node = shelf.readinfo()[b'node'] if node is None or node not in repo: @@ -1126,7 +1132,7 @@ else: basename = shelved[0] -if not Shelf.open(repo, basename).exists(): +if not ShelfDir(repo).get(basename).exists(): raise error.InputError(_(b"shelved change '%s' not found") % basename) return _dounshelve(ui, repo, basename, opts) To: martinvonz, #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
D9744: shelve: move listshelves() to new ShelfDir class, so caller need not pass vfs
martinvonz 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/D9744 AFFECTED FILES mercurial/shelve.py CHANGE DETAILS diff --git a/mercurial/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -80,6 +80,28 @@ def get(self, name): return Shelf(self.vfs, name) +def listshelves(self): +"""return all shelves in repo as list of (time, name)""" +try: +names = self.vfs.listdir() +except OSError as err: +if err.errno != errno.ENOENT: +raise +return [] +info = [] +seen = set() +for filename in names: +name = filename.rsplit(b'.', 1)[0] +if name in seen: +continue +seen.add(name) +shelf = self.get(name) +if not shelf.exists(): +continue +mtime = shelf.mtime() +info.append((mtime, name)) +return sorted(info, reverse=True) + class Shelf(object): """Represents a shelf, including possibly multiple files storing it. @@ -332,9 +354,9 @@ def cleanupoldbackups(repo): -vfs = vfsmod.vfs(repo.vfs.join(backupdir)) maxbackups = repo.ui.configint(b'shelve', b'maxbackups') -hgfiles = listshelves(vfs) +backup_dir = ShelfDir(repo, for_backups=True) +hgfiles = backup_dir.listshelves() if maxbackups > 0 and maxbackups < len(hgfiles): bordermtime = hgfiles[maxbackups - 1][0] else: @@ -343,7 +365,7 @@ if mtime == bordermtime: # keep it, because timestamp can't decide exact order of backups continue -Shelf.open_backup(repo, name).delete() +backup_dir.get(name).delete() def _backupactivebookmark(repo): @@ -604,10 +626,10 @@ """subcommand that deletes all shelves""" with repo.wlock(): -vfs = vfsmod.vfs(repo.vfs.join(shelvedir)) +shelf_dir = ShelfDir(repo) backupvfs = vfsmod.vfs(repo.vfs.join(backupdir)) -for _mtime, name in listshelves(vfs): -Shelf(vfs, name).movetobackup(backupvfs) +for _mtime, name in shelf_dir.listshelves(): +shelf_dir.get(name).movetobackup(backupvfs) cleanupoldbackups(repo) @@ -627,29 +649,6 @@ cleanupoldbackups(repo) -def listshelves(vfs): -"""return all shelves in repo as list of (time, name)""" -try: -names = vfs.listdir() -except OSError as err: -if err.errno != errno.ENOENT: -raise -return [] -info = [] -seen = set() -for filename in names: -name = filename.rsplit(b'.', 1)[0] -if name in seen: -continue -seen.add(name) -shelf = Shelf(vfs, name) -if not shelf.exists(): -continue -mtime = shelf.mtime() -info.append((mtime, name)) -return sorted(info, reverse=True) - - def listcmd(ui, repo, pats, opts): """subcommand that displays the list of shelves""" pats = set(pats) @@ -658,9 +657,8 @@ width = ui.termwidth() namelabel = b'shelve.newest' ui.pager(b'shelve') -vfs = vfsmod.vfs(repo.vfs.join(shelvedir)) shelf_dir = ShelfDir(repo) -for mtime, name in listshelves(vfs): +for mtime, name in shelf_dir.listshelves(): if pats and name not in pats: continue ui.write(name, label=namelabel) @@ -700,15 +698,14 @@ def patchcmds(ui, repo, pats, opts): """subcommand that displays shelves""" +shelf_dir = ShelfDir(repo) if len(pats) == 0: -vfs = vfsmod.vfs(repo.vfs.join(shelvedir)) -shelves = listshelves(vfs) +shelves = shelf_dir.listshelves() if not shelves: raise error.Abort(_(b"there are no shelves to show")) mtime, name = shelves[0] pats = [name] -shelf_dir = ShelfDir(repo) for shelfname in pats: if not shelf_dir.get(shelfname).exists(): raise error.Abort(_(b"cannot find shelf %s") % shelfname) @@ -1123,8 +1120,7 @@ elif len(shelved) > 1: raise error.InputError(_(b'can only unshelve one change at a time')) elif not shelved: -vfs = vfsmod.vfs(repo.vfs.join(shelvedir)) -shelved = listshelves(vfs) +shelved = ShelfDir(repo).listshelves() if not shelved: raise error.StateError(_(b'no shelved changes to apply!')) basename = shelved[0][1] To: martinvonz, #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
D9745: revlog: use size_t for nodetree capacity
quark created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This allows handling revlog containing more than 33554432 (INT_MAX / sizeof(nodetreenode)) revisions on x64 platforms. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9745 AFFECTED FILES mercurial/cext/revlog.c CHANGE DETAILS diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c --- a/mercurial/cext/revlog.c +++ b/mercurial/cext/revlog.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -55,10 +56,10 @@ indexObject *index; nodetreenode *nodes; Py_ssize_t nodelen; - unsigned length; /* # nodes in use */ - unsigned capacity; /* # nodes allocated */ - int depth; /* maximum depth of tree */ - int splits;/* # splits performed */ + size_t length; /* # nodes in use */ + size_t capacity; /* # nodes allocated */ + int depth; /* maximum depth of tree */ + int splits; /* # splits performed */ } nodetree; typedef struct { @@ -1536,10 +1537,10 @@ static int nt_new(nodetree *self) { if (self->length == self->capacity) { - unsigned newcapacity; + size_t newcapacity; nodetreenode *newnodes; newcapacity = self->capacity * 2; - if (newcapacity >= INT_MAX / sizeof(nodetreenode)) { + if (newcapacity >= SIZE_MAX / sizeof(nodetreenode)) { PyErr_SetString(PyExc_MemoryError, "overflow in nt_new"); return -1; @@ -1643,7 +1644,7 @@ self->nodelen = index->nodelen; self->depth = 0; self->splits = 0; - if ((size_t)self->capacity > INT_MAX / sizeof(nodetreenode)) { + if (self->capacity > SIZE_MAX / sizeof(nodetreenode)) { PyErr_SetString(PyExc_ValueError, "overflow in init_nt"); return -1; } To: quark, #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 #16130 has failed for branch/default | f044bddc
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: f044bddc ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/f044bddc33444de1f8b29d3adefd191999ac1fc0 ) Commit Message: engine: make hook point for extension a public ... Commit Author: Pulkit Goyal ( https://foss.heptapod.net/pulkit.goyal ) Pipeline #16130 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/16130 ) triggered by Administrator ( https://foss.heptapod.net/root ) had 2 failed builds. Job #150289 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/150289/raw ) Stage: tests Name: checks-py3 Job #150288 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/150288/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
D9746: tests: make test-subrepo-git.t compatible with git's master->main rename
martinvonz created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Git is about to change the default branch from "master" to "main". Recent versions has started warning about that, which makes tests fail. I assume the tests would fail in a different way once the default has changed. To make us compatible with that name change, let's set configure the default to be "master". That value makes the tests still work on older Git version (those where the default branch name is not configurable). REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9746 AFFECTED FILES tests/test-subrepo-git.t CHANGE DETAILS diff --git a/tests/test-subrepo-git.t b/tests/test-subrepo-git.t --- a/tests/test-subrepo-git.t +++ b/tests/test-subrepo-git.t @@ -17,6 +17,10 @@ $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE $ GIT_CONFIG_NOSYSTEM=1; export GIT_CONFIG_NOSYSTEM +set default branch to value compatible with new and old git version + + $ git config --global init.defaultBranch master + root hg repo $ hg init t To: martinvonz, #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 #16210 has failed for branch/default | 85e7b083
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: 85e7b083 ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/85e7b083fce9652cee26e06140f059568b717901 ) Commit Message: upgrade: demonstrate that a no-op upgrade still... Commit Author: Pulkit Goyal ( https://foss.heptapod.net/pulkit.goyal ) Pipeline #16210 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/16210 ) triggered by Administrator ( https://foss.heptapod.net/root ) had 4 failed builds. Job #150475 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/150475/raw ) Stage: tests Name: test-py2-pure Job #150476 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/150476/raw ) Stage: tests Name: test-py3-pure Job #150468 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/150468/raw ) Stage: tests Name: checks-py2 Job #150469 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/150469/raw ) Stage: tests Name: checks-py3 -- 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 #16331 has failed for branch/default | be4d07a4
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: be4d07a4 ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/be4d07a4866ffc1625092ad607d3ba5b47e51960 ) Commit Message: revlog: use size_t for nodetree capacity This ... Commit Author: Jun Wu Pipeline #16331 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/16331 ) triggered by Administrator ( https://foss.heptapod.net/root ) had 4 failed builds. Job #150737 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/150737/raw ) Stage: tests Name: test-py2-pure Job #150738 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/150738/raw ) Stage: tests Name: test-py3-pure Job #150730 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/150730/raw ) Stage: tests Name: checks-py2 Job #150731 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/150731/raw ) Stage: tests Name: checks-py3 -- 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