view tests/test-revset-dirstate-parents.t @ 51721:ed28085827ec

typing: explicitly type some `mercurial.util` eol code to avoid @overload Unlike the previous commit, this makes a material difference in the generated stub file- the `pycompat.identity()` aliases generated an @overload like this: @overload def fromnativeeol(a: _T0) -> _T0: ... ... which might fail to detect a bad argument, like str. This drops the @overload for the 3 related methods, so there's a single definition for each. The `typelib.BinaryIO_Proxy` is used for subclassing (the same as was done in 8147abc05794), so that it is a `BinaryIO` type during type checking, but still inherits `object` at runtime. That way, we don't need to implement unused abstract methods.
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 19 Jul 2024 16:49:46 -0400
parents 7bbc4e113e5f
children
line wrap: on
line source

  $ HGENCODING=utf-8
  $ export HGENCODING

  $ try() {
  >   hg debugrevspec --debug $@
  > }

  $ log() {
  >   hg log --template '{rev}\n' -r "$1"
  > }

  $ hg init repo
  $ cd repo

  $ try 'p1()'
  (func
    (symbol 'p1')
    None)
  * set:
  <baseset []>
  $ try 'p2()'
  (func
    (symbol 'p2')
    None)
  * set:
  <baseset []>
  $ try 'parents()'
  (func
    (symbol 'parents')
    None)
  * set:
  <baseset+ []>

null revision
  $ log 'p1()'
  $ log 'p2()'
  $ log 'parents()'

working dir with a single parent
  $ echo a > a
  $ hg ci -Aqm0
  $ log 'p1()'
  0
  $ log 'tag() and p1()'
  $ log 'p2()'
  $ log 'parents()'
  0
  $ log 'tag() and parents()'

merge in progress
  $ echo b > b
  $ hg ci -Aqm1
  $ hg up -q 0
  $ echo c > c
  $ hg ci -Aqm2
  $ hg merge -q
  $ log 'p1()'
  2
  $ log 'p2()'
  1
  $ log 'tag() and p2()'
  $ log 'parents()'
  1
  2

  $ cd ..