tests/test-status-terse.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Fri, 05 Apr 2024 11:05:54 +0200
changeset 51576 de5bf3fe0233
parent 48338 f9db8eeb3aec
permissions -rw-r--r--
revset: stop serializing node when using "%ln" Turning hundred of thousand of node from node to hex and back can be slow… what about we stop doing it? In many case were we are using node id we should be using revision id. However this is not a good reason to have a stupidly slow implementation of "%ln". This caught my attention again because the phase discovery during push make an extensive use of "%ln" or huge set. In absolute, that phase discovery probably should use "%ld" and need to improves its algorithmic complexity, but improving "%ln" seems simple and long overdue. This greatly speeds up `hg push` on repository with many drafts. Here are some relevant poulpe benchmarks: ### data-env-vars.name = mozilla-try-2023-03-22-zstd-sparse-revlog # benchmark.name = hg.command.push # bin-env-vars.hg.flavor = default # bin-env-vars.hg.py-re2-module = default # benchmark.variants.explicit-rev = all-out-heads # benchmark.variants.issue6528 = disabled # benchmark.variants.protocol = ssh # benchmark.variants.reuse-external-delta-parent = default ## benchmark.variants.revs = any-1-extra-rev before: 44.235070 after: 20.416329 (-53.85%, -23.82) ## benchmark.variants.revs = any-100-extra-rev before: 49.234697 after: 26.519829 (-46.14%, -22.71) ### benchmark.name = hg.command.bundle # bin-env-vars.hg.flavor = default # bin-env-vars.hg.py-re2-module = default # benchmark.variants.revs = all # benchmark.variants.type = none-streamv2 ## data-env-vars.name = heptapod-public-2024-03-25-zstd-sparse-revlog before: 10.138396 after: 7.750458 (-23.55%, -2.39) ## data-env-vars.name = mercurial-public-2024-03-22-zstd-sparse-revlog before: 1.263859 after: 0.700229 (-44.60%, -0.56) ## data-env-vars.name = mozilla-try-2023-03-22-zstd-sparse-revlog before: 399.484481 after: 346.5089 (-13.26%, -52.98) ## data-env-vars.name = pypy-2024-03-22-zstd-sparse-revlog before: 4.540080 after: 3.401700 (-25.07%, -1.14) ## data-env-vars.name = tryton-public-2024-03-22-zstd-sparse-revlog before: 2.975765 after: 1.870798 (-37.13%, -1.10)

  $ mkdir folder
  $ cd folder
  $ hg init
  $ mkdir x x/l x/m x/n x/l/u x/l/u/a
  $ touch a b x/aa.o x/bb.o
  $ hg status
  ? a
  ? b
  ? x/aa.o
  ? x/bb.o

  $ hg status --terse u
  ? a
  ? b
  ? x/
  $ hg status --terse maudric
  ? a
  ? b
  ? x/
  $ hg status --terse madric
  ? a
  ? b
  ? x/aa.o
  ? x/bb.o
  $ hg status --terse f
  abort: 'f' not recognized
  [10]

Add a .hgignore so that we can also have ignored files

  $ echo ".*\.o" > .hgignore
  $ hg status
  ? .hgignore
  ? a
  ? b
  $ hg status -i
  I x/aa.o
  I x/bb.o

Tersing ignored files
  $ hg status -t i --ignored
  I x/

Adding more files
  $ mkdir y
  $ touch x/aa x/bb y/l y/m y/l.o y/m.o
  $ touch x/l/aa x/m/aa x/n/aa x/l/u/bb x/l/u/a/bb

  $ hg status
  ? .hgignore
  ? a
  ? b
  ? x/aa
  ? x/bb
  ? x/l/aa
  ? x/l/u/a/bb
  ? x/l/u/bb
  ? x/m/aa
  ? x/n/aa
  ? y/l
  ? y/m

  $ hg status --terse u
  ? .hgignore
  ? a
  ? b
  ? x/
  ? y/

Run from subdirectory
  $ hg status --terse u --cwd x/l
  ? .hgignore
  ? a
  ? b
  ? x/
  ? y/
  $ relstatus() {
  >   hg status --terse u --config commands.status.relative=1 "$@";
  > }
This should probably have {"l/", "m/", "n/"} instead of {"."}. They should
probably come after "../y/".
  $ relstatus --cwd x
  ? ../.hgignore
  ? ../a
  ? ../b
  ? .
  ? ../y/
This should probably have {"u/", "../m/", "../n/"} instead of {"../"}.
  $ relstatus --cwd x/l
  ? ../../.hgignore
  ? ../../a
  ? ../../b
  ? ../
  ? ../../y/
This should probably have {"a/", "bb", "../aa", "../../m/", "../../n/"}
instead of {"../../"}.
  $ relstatus --cwd x/l/u
  ? ../../../.hgignore
  ? ../../../a
  ? ../../../b
  ? ../../
  ? ../../../y/
This should probably have {"bb", "../bb", "../../aa", "../../../m/",
"../../../n/"} instead of {"../../../"}.
  $ relstatus --cwd x/l/u/a
  ? ../../../../.hgignore
  ? ../../../../a
  ? ../../../../b
  ? ../../../
  ? ../../../../y/

  $ hg add x/aa x/bb .hgignore
  $ hg status --terse au
  A .hgignore
  A x/aa
  A x/bb
  ? a
  ? b
  ? x/l/
  ? x/m/
  ? x/n/
  ? y/

Including ignored files

  $ hg status --terse aui
  A .hgignore
  A x/aa
  A x/bb
  ? a
  ? b
  ? x/l/
  ? x/m/
  ? x/n/
  ? y/l
  ? y/m
  $ hg status --terse au -i
  I x/aa.o
  I x/bb.o
  I y/l.o
  I y/m.o

Committing some of the files

  $ hg commit x/aa x/bb .hgignore -m "First commit"
  $ hg status
  ? a
  ? b
  ? x/l/aa
  ? x/l/u/a/bb
  ? x/l/u/bb
  ? x/m/aa
  ? x/n/aa
  ? y/l
  ? y/m
  $ hg status --terse mardu
  ? a
  ? b
  ? x/l/
  ? x/m/
  ? x/n/
  ? y/

Modifying already committed files

  $ echo "Hello" >> x/aa
  $ echo "World" >> x/bb
  $ hg status --terse maurdc
  M x/aa
  M x/bb
  ? a
  ? b
  ? x/l/
  ? x/m/
  ? x/n/
  ? y/

Respecting other flags

  $ hg status --terse marduic --all
  M x/aa
  M x/bb
  ? a
  ? b
  ? x/l/
  ? x/m/
  ? x/n/
  ? y/l
  ? y/m
  I x/aa.o
  I x/bb.o
  I y/l.o
  I y/m.o
  C .hgignore
  $ hg status --terse marduic -a
  $ hg status --terse marduic -c
  C .hgignore
  $ hg status --terse marduic -m
  M x/aa
  M x/bb

Passing 'i' in terse value will consider the ignored files while tersing

  $ hg status --terse marduic -u
  ? a
  ? b
  ? x/l/
  ? x/m/
  ? x/n/
  ? y/l
  ? y/m

Omitting 'i' in terse value does not consider ignored files while tersing

  $ hg status --terse marduc -u
  ? a
  ? b
  ? x/l/
  ? x/m/
  ? x/n/
  ? y/

Trying with --rev

  $ hg status --terse marduic --rev 0 --rev 1
  abort: cannot use --terse with --rev
  [10]

Config item to set the default terseness
  $ cat <<EOF >> $HGRCPATH
  > [commands]
  > status.terse = u
  > EOF
  $ hg status -mu
  M x/aa
  M x/bb
  ? a
  ? b
  ? x/l/
  ? x/m/
  ? x/n/
  ? y/

Command line flag overrides the default
  $ hg status --terse=
  M x/aa
  M x/bb
  ? a
  ? b
  ? x/l/aa
  ? x/l/u/a/bb
  ? x/l/u/bb
  ? x/m/aa
  ? x/n/aa
  ? y/l
  ? y/m
  $ hg status --terse=mardu
  M x/aa
  M x/bb
  ? a
  ? b
  ? x/l/
  ? x/m/
  ? x/n/
  ? y/

Specifying --rev should still work, with the terseness disabled.
  $ hg status --rev 0
  M x/aa
  M x/bb
  ? a
  ? b
  ? x/l/aa
  ? x/l/u/a/bb
  ? x/l/u/bb
  ? x/m/aa
  ? x/n/aa
  ? y/l
  ? y/m