view tests/test-githelp.t @ 49777:e1953a34c110

bundle: emit full snapshot as is, without doing a redelta With the new `forced` delta-reused policy, it become important to be able to send full snapshot where full snapshot are needed. Otherwise, the fallback delta will simply be used on the client sideā€¦ creating monstrous delta chain, since revision that are meant as a reset of delta-chain chain becoming too complex are simply adding a new full delta-tree on the leaf of another one. In the `non-forced` cases, client process full snapshot from the bundle differently from deltas, so client will still try to convert the full snapshot into a delta if possible. So this will no lead to pathological storage explosion. I have considered making this configurable, but the impact seems limited enough that it does not seems to be worth it. Especially with the current sparse-revlog format that use "delta-tree" with multiple level snapshots, full snapshot are much less frequent and not that different from other intermediate snapshot that we are already sending over the wire anyway. CPU wise, this will help the bundling side a little as it will not need to reconstruct revisions and compute deltas. The unbundling side might save a tiny amount of CPU as it won't need to reconstruct the delta-base to reconstruct the revision full text. This only slightly visible in some of the benchmarks. And have no real impact on most of them. ### data-env-vars.name = pypy-2018-08-01-zstd-sparse-revlog # benchmark.name = perf-bundle # benchmark.variants.revs = last-40000 before: 11.467186 seconds just-emit-full: 11.190576 seconds (-2.41%) with-pull-force: 11.041091 seconds (-3.72%) # benchmark.name = perf-unbundle # benchmark.variants.revs = last-40000 before: 16.744862 just-emit-full:: 16.561036 seconds (-1.10%) with-pull-force: 16.389344 seconds (-2.12%) # benchmark.name = pull # benchmark.variants.revs = last-40000 before: 26.870569 just-emit-full: 26.391188 seconds (-1.78%) with-pull-force: 25.633184 seconds (-4.60%) Space wise (so network-wise) the impact is fairly small. When taking compression into account. Below are tests the size of `hg bundle --all` for a handful of benchmark repositories (with bzip, zstd compression and without it) This show a small increase in the bundle size, but nothing really significant except maybe for mozilla-try (+12%) that nobody really pulls large chunk of anyway. Mozilla-try is also the repository that benefit the most for not having to recompute deltas client size. ### mercurial: bzip-before: 26 406 342 bytes bzip-after: 26 691 543 bytes +1.08% zstd-before: 27 918 645 bytes zstd-after: 28 075 896 bytes +0.56% none-before: 98 675 601 bytes none-after: 100 411 237 bytes +1.76% ### pypy bzip-before: 201 295 752 bytes bzip-after: 209 780 282 bytes +4.21% zstd-before: 202 974 795 bytes zstd-after: 205 165 780 bytes +1.08% none-before: 871 070 261 bytes none-after: 993 595 057 bytes +14.07% ### netbeans bzip-before: 601 314 330 bytes bzip-after: 614 246 241 bytes +2.15% zstd-before: 604 745 136 bytes zstd-after: 615 497 705 bytes +1.78% none-before: 3 338 238 571 bytes none-after: 3 439 422 535 bytes +3.03% ### mozilla-central bzip-before: 1 493 006 921 bytes bzip-after: 1 549 650 570 bytes +3.79% zstd-before: 1 481 910 102 bytes zstd-after: 1 513 052 415 bytes +2.10% none-before: 6 535 929 910 bytes none-after: 7 010 191 342 bytes +7.26% ### mozilla-try bzip-before: 6 583 425 999 bytes bzip-after: 7 423 536 928 bytes +12.76% zstd-before: 6 021 009 212 bytes zstd-after: 6 674 922 420 bytes +10.86% none-before: 22 954 739 558 bytes none-after: 26 013 854 771 bytes +13.32%
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 07 Dec 2022 20:12:23 +0100
parents 94f227baa76f
children
line wrap: on
line source

  $ cat >> $HGRCPATH << EOF
  > [extensions]
  > githelp =
  > EOF

  $ hg init repo
  $ cd repo
  $ echo foo > test_file
  $ mkdir dir
  $ echo foo > dir/file
  $ echo foo > removed_file
  $ echo foo > deleted_file
  $ hg add -q .
  $ hg commit -m 'bar'
  $ hg bookmark both
  $ touch both
  $ touch untracked_file
  $ hg remove removed_file
  $ rm deleted_file

githelp on a single command should succeed
  $ hg githelp -- commit
  hg commit
  $ hg githelp -- git commit
  hg commit

githelp should fail nicely if we don't give it arguments
  $ hg githelp
  abort: missing git command - usage: hg githelp -- <git command>
  [255]
  $ hg githelp -- git
  abort: missing git command - usage: hg githelp -- <git command>
  [255]

githelp on a command with options should succeed
  $ hg githelp -- commit -pm "abc"
  hg commit --interactive -m 'abc'

githelp on a command with standalone unrecognized option should succeed with warning
  $ hg githelp -- commit -p -v
  ignoring unknown option -v
  hg commit --interactive

githelp on a command with unrecognized option packed with other options should fail with error
  $ hg githelp -- commit -pv
  abort: unknown option 'v' packed with other options
  (please try passing the option as its own flag: -v)
  [255]

githelp for git rebase --skip
  $ hg githelp -- git rebase --skip
  hg revert --all -r .
  hg rebase --continue

githelp for git commit --amend (hg commit --amend pulls up an editor)
  $ hg githelp -- commit --amend
  hg commit --amend

githelp for git commit --amend --no-edit (hg amend does not pull up an editor)
  $ hg githelp -- commit --amend --no-edit
  hg amend

githelp for git checkout -- . (checking out a directory)
  $ hg githelp -- checkout -- .
  note: use --no-backup to avoid creating .orig files
  
  hg revert .

githelp for git checkout "HEAD^" (should still work to pass a rev)
  $ hg githelp -- checkout "HEAD^"
  hg update .^

githelp checkout: args after -- should be treated as paths no matter what
  $ hg githelp -- checkout -- HEAD
  note: use --no-backup to avoid creating .orig files
  
  hg revert HEAD

githelp for git checkout with rev and path
  $ hg githelp -- checkout "HEAD^" -- file.txt
  note: use --no-backup to avoid creating .orig files
  
  hg revert -r .^ file.txt

githelp for git with rev and path, without separator
  $ hg githelp -- checkout "HEAD^" file.txt
  note: use --no-backup to avoid creating .orig files
  
  hg revert -r .^ file.txt

githelp for checkout with a file as first argument
  $ hg githelp -- checkout test_file
  note: use --no-backup to avoid creating .orig files
  
  hg revert test_file

githelp for checkout with a removed file as first argument
  $ hg githelp -- checkout removed_file
  note: use --no-backup to avoid creating .orig files
  
  hg revert removed_file

githelp for checkout with a deleted file as first argument
  $ hg githelp -- checkout deleted_file
  note: use --no-backup to avoid creating .orig files
  
  hg revert deleted_file

githelp for checkout with a untracked file as first argument
  $ hg githelp -- checkout untracked_file
  note: use --no-backup to avoid creating .orig files
  
  hg revert untracked_file

githelp for checkout with a directory as first argument
  $ hg githelp -- checkout dir
  note: use --no-backup to avoid creating .orig files
  
  hg revert dir

githelp for checkout when not in repo root
  $ cd dir
  $ hg githelp -- checkout file
  note: use --no-backup to avoid creating .orig files
  
  hg revert file

  $ cd ..

githelp for checkout with an argument that is both a file and a revision
  $ hg githelp -- checkout both
  hg update both

githelp for checkout with the -p option
  $ hg githelp -- git checkout -p xyz
  hg revert -i -r xyz

  $ hg githelp -- git checkout -p xyz -- abc
  note: use --no-backup to avoid creating .orig files
  
  hg revert -i -r xyz abc

githelp for checkout with the -f option and a rev
  $ hg githelp -- git checkout -f xyz
  hg update -C xyz
  $ hg githelp -- git checkout --force xyz
  hg update -C xyz

githelp for checkout with the -f option without an arg
  $ hg githelp -- git checkout -f
  hg revert --all
  $ hg githelp -- git checkout --force
  hg revert --all

githelp for grep with pattern and path
  $ hg githelp -- grep shrubbery flib/intern/
  hg grep shrubbery flib/intern/

githelp for reset, checking ~ in git becomes ~1 in mercurial
  $ hg githelp -- reset HEAD~
  hg update .~1
  $ hg githelp -- reset "HEAD^"
  hg update .^
  $ hg githelp -- reset HEAD~3
  hg update .~3

  $ hg githelp -- reset --mixed HEAD
  note: --mixed has no meaning since Mercurial has no staging area
  
  hg update .
  $ hg githelp -- reset --soft HEAD
  note: --soft has no meaning since Mercurial has no staging area
  
  hg update .
  $ hg githelp -- reset --hard HEAD
  hg update --clean .

githelp for git show --name-status
  $ hg githelp -- git show --name-status
  hg log --style status -r .

githelp for git show --pretty=format: --name-status
  $ hg githelp -- git show --pretty=format: --name-status
  hg status --change .

githelp for show with no arguments
  $ hg githelp -- show
  hg export

githelp for show with a path
  $ hg githelp -- show test_file
  hg cat test_file

githelp for show with not a path:
  $ hg githelp -- show rev
  hg export rev

githelp for show with many arguments
  $ hg githelp -- show argone argtwo
  hg export argone argtwo
  $ hg githelp -- show test_file argone argtwo
  hg cat test_file argone argtwo

githelp for show with --unified options
  $ hg githelp -- show --unified=10
  hg export --config diff.unified=10
  $ hg githelp -- show -U100
  hg export --config diff.unified=100

githelp for show with a path and --unified
  $ hg githelp -- show -U20 test_file
  hg cat test_file --config diff.unified=20

githelp for stash drop without name
  $ hg githelp -- git stash drop
  hg shelve -d <shelve name>

githelp for stash drop with name
  $ hg githelp -- git stash drop xyz
  hg shelve -d xyz

githelp for stash list with patch
  $ hg githelp -- git stash list -p
  hg shelve -l -p

githelp for stash show
  $ hg githelp -- git stash show
  hg shelve --stat

githelp for stash show with patch and name
  $ hg githelp -- git stash show -p mystash
  hg shelve -p mystash

githelp for stash clear
  $ hg githelp -- git stash clear
  hg shelve --cleanup

githelp for whatchanged should show deprecated message
  $ hg githelp -- whatchanged -p
  this command has been deprecated in the git project, thus isn't supported by this tool
  

githelp for git branch -m renaming
  $ hg githelp -- git branch -m old new
  hg bookmark -m old new

When the old name is omitted, git branch -m new renames the current branch.
  $ hg githelp -- git branch -m new
  hg bookmark -m `hg log -T"{activebookmark}" -r .` new

Branch deletion in git strips commits
  $ hg githelp -- git branch -d
  hg strip -B
  $ hg githelp -- git branch -d feature
  hg strip -B feature -B
  $ hg githelp -- git branch --delete experiment1 experiment2
  hg strip -B experiment1 -B experiment2 -B

githelp for reuse message using the shorthand
  $ hg githelp -- git commit -C deadbeef
  hg commit -M deadbeef

githelp for reuse message using the the long version
  $ hg githelp -- git commit --reuse-message deadbeef
  hg commit -M deadbeef

githelp for reuse message using HEAD
  $ hg githelp -- git commit --reuse-message HEAD~
  hg commit -M .~1

githelp for apply with no options
  $ hg githelp -- apply
  hg import --no-commit

githelp for apply with directory strip custom
  $ hg githelp -- apply -p 5
  hg import --no-commit -p 5

githelp for apply with prefix directory
  $ hg githelp -- apply --directory=modules
  hg import --no-commit --prefix modules

git merge-base
  $ hg githelp -- git merge-base --is-ancestor
  ignoring unknown option --is-ancestor
  note: ancestors() is part of the revset language
  (learn more about revsets with 'hg help revsets')
  
  hg log -T '{node}\n' -r 'ancestor(A,B)'

githelp for git blame
  $ hg githelp -- git blame
  hg annotate -udl

githelp for add

  $ hg githelp -- git add
  hg add

  $ hg githelp -- git add -p
  note: Mercurial will commit when complete, as there is no staging area in Mercurial
  
  hg commit --interactive

  $ hg githelp -- git add --all
  note: use hg addremove to remove files that have been deleted
  
  hg add

githelp for reflog

  $ hg githelp -- git reflog
  hg journal
  
  note: in hg commits can be deleted from repo but we always have backups

  $ hg githelp -- git reflog --all
  hg journal --all
  
  note: in hg commits can be deleted from repo but we always have backups

  $ hg githelp -- git log -Gnarf
  hg grep --diff narf
  $ hg githelp -- git log -S narf
  hg grep --diff narf
  $ hg githelp -- git log --pickaxe-regex narf
  hg grep --diff narf