Mercurial > hg
view tests/test-amend-subrepo.t @ 49652:03792c1ed341
contrib: add a script for adding vendored type stubs to typeshed
I really hate this, but pytype doesn't support PEP 561 and doesn't seem to have
the equivalent of `MYPYPATH` to point to custom stubs. Ignoring the vendored
stubs isn't necessarily harmful, but pytype has been choking on the vendored
attr package after pytype 2022.03.29 with errors like this:
File "/mnt/c/Users/Matt/hg/mercurial/linelog.py", line 52, in __iter__: Built-in function iter was called with the wrong arguments [wrong-arg-types]
Expected: (collection: bytearray)
Actually passed: (collection: mercurial.thirdparty.attr._make._CountingAttr)
File "/mnt/c/Users/Matt/hg/mercurial/dirstateutils/v2.py", line 143, in pack: Built-in function len was called with the wrong arguments [wrong-arg-types]
Expected: (obj: Sized)
Actually passed: (obj: mercurial.thirdparty.attr._make._CountingAttr)
Attributes of protocol Sized are not implemented on mercurial.thirdparty.attr._make._CountingAttr: __len__
File "/mnt/c/Users/Matt/hg/mercurial/dirstateutils/v2.py", line 144, in pack: No attribute 'rfind' on mercurial.thirdparty.attr._make._CountingAttr [attribute-error]
File "/mnt/c/Users/Matt/hg/mercurial/dirstateutils/v2.py", line 146, in pack: Built-in function len was called with the wrong arguments [wrong-arg-types]
Expected: (obj: Sized)
Actually passed: (obj: mercurial.thirdparty.attr._make._CountingAttr)
Attributes of protocol Sized are not implemented on mercurial.thirdparty.attr._make._CountingAttr: __len__
File "/mnt/c/Users/Matt/hg/mercurial/dirstateutils/v2.py", line 152, in pack: No attribute 'v2_data' on mercurial.thirdparty.attr._make._CountingAttr [attribute-error]
File "/mnt/c/Users/Matt/hg/mercurial/util.py", line 2817, in go: unsupported operand type(s) for /: 'count: mercurial.thirdparty.attr._make._CountingAttr' and 'float: float' [unsupported-operands]
No attribute '__truediv__' on 'count: mercurial.thirdparty.attr._make._CountingAttr' or '__rtruediv__' on 'float: float'
Called from (traceback):
line 2981, in __bytes__
This is essentially the same hack we've been using in TortoiseHg to add the
vendored PyQt5 stubs. What I don't understand is pytype *still* generates *.pyi
files under .pytype/pyi/mercurial/thirdparty/attr, even when the package is
explicitly ignored in the pytype command line args. But it avoids the errors,
which means we aren't stuck on pytype==2022.03.29.
https://github.com/google/pytype/issues/151
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 23 Nov 2022 20:50:39 -0500 |
parents | 4b7d5d10c45d |
children | c84844cd523a |
line wrap: on
line source
#testcases obsstore-off obsstore-on $ cat << EOF >> $HGRCPATH > [extensions] > amend = > EOF #if obsstore-on $ cat << EOF >> $HGRCPATH > [experimental] > evolution.createmarkers = True > EOF #endif Prepare parent repo ------------------- $ hg init r $ cd r $ echo a > a $ hg ci -Am0 adding a Link first subrepo ------------------ $ echo 's = s' >> .hgsub $ hg add .hgsub $ hg init s amend without .hgsub $ hg amend s abort: can't commit subrepos without .hgsub [255] amend with subrepo $ hg amend saved backup bundle to * (glob) (obsstore-off !) $ hg status --change . A .hgsub A .hgsubstate A a $ cat .hgsubstate 0000000000000000000000000000000000000000 s Update subrepo -------------- add new commit to be amended $ echo a >> a $ hg ci -m1 amend with dirty subrepo $ echo a >> s/a $ hg add -R s adding s/a $ hg amend abort: uncommitted changes in subrepository "s" (use --subrepos for recursive commit) [255] amend with modified subrepo $ hg ci -R s -m0 $ hg amend saved backup bundle to * (glob) (obsstore-off !) $ hg status --change . M .hgsubstate M a $ cat .hgsubstate f7b1eb17ad24730a1651fccd46c43826d1bbc2ac s revert subrepo change $ hg up -R s -q null $ hg amend saved backup bundle to * (glob) (obsstore-off !) $ hg status --change . M a Link another subrepo -------------------- add new commit to be amended $ echo b >> b $ hg ci -qAm2 also checks if non-subrepo change is included $ echo a >> a amend with another subrepo $ hg init t $ echo b >> t/b $ hg ci -R t -Am0 adding b $ echo 't = t' >> .hgsub $ hg amend saved backup bundle to * (glob) (obsstore-off !) $ hg status --change . M .hgsub M .hgsubstate M a A b $ cat .hgsubstate 0000000000000000000000000000000000000000 s bfb1a4fb358498a9533dabf4f2043d94162f1fcd t Unlink one subrepo ------------------ add new commit to be amended $ echo a >> a $ hg ci -m3 $ echo 't = t' > .hgsub --interactive won't silently ignore dirty subrepos $ echo modified > t/b $ hg amend --interactive --config ui.interactive=True abort: uncommitted changes in subrepository "t" [255] $ hg amend --interactive --config ui.interactive=True --config ui.commitsubrepos=True abort: uncommitted changes in subrepository "t" [255] $ hg -R t revert -q --all --no-backup amend with one subrepo dropped $ hg amend saved backup bundle to * (glob) (obsstore-off !) $ hg status --change . M .hgsub M .hgsubstate M a $ cat .hgsubstate bfb1a4fb358498a9533dabf4f2043d94162f1fcd t Unlink subrepos completely -------------------------- add new commit to be amended $ echo a >> a $ hg ci -m3 amend with .hgsub removed $ hg rm .hgsub $ hg amend saved backup bundle to * (glob) (obsstore-off !) $ hg status --change . M a R .hgsub R .hgsubstate broken repositories will refuse to push #if obsstore-off $ hg up -q -C 2 #else $ hg up -q -C 6 #endif $ echo c >> t/b $ hg amend -q -R t $ hg init ../dest $ hg init ../dest/t $ hg init ../dest/s $ hg push -q ../dest abort: subrepo 't' is hidden in revision 04aa62396ec6 (obsstore-on !) abort: subrepo 't' not found in revision 04aa62396ec6 (obsstore-off !) [255] ... unless forced $ hg push --force -q ../dest $ hg verify -R ../dest checking changesets checking manifests crosschecking files in changesets and manifests checking files checked 5 changesets with 12 changes to 4 files checking subrepo links subrepo 't' not found in revision 04aa62396ec6 subrepo 't' not found in revision 6bce99600681 $ cd ..