view tests/test-histedit-base.t @ 44363:f7459da77f23

nodemap: introduce an option to use mmap to read the nodemap mapping The performance and memory benefit is much greater if we don't have to copy all the data in memory for each information. So we introduce an option (on by default) to read the data using mmap. This changeset is the last one definition the API for index support nodemap data. (they have to be able to use the mmaping). Below are some benchmark comparing the best we currently have in 5.3 with the final step of this series (using the persistent nodemap implementation in Rust). The benchmark run `hg perfindex` with various revset and the following variants: Before: * do not use the persistent nodemap * use the CPython implementation of the index for nodemap * use mmapping of the changelog index After: * use the MixedIndex Rust code, with the NodeTree object for nodemap access (still in review) * use the persistent nodemap data from disk * access the persistent nodemap data through mmap * use mmapping of the changelog index The persistent nodemap greatly speed up most operation on very large repositories. Some of the previously very fast lookup end up a bit slower because the persistent nodemap has to be setup. However the absolute slowdown is very small and won't matters in the big picture. Here are some numbers (in seconds) for the reference copy of mozilla-try: Revset Before After abs-change speedup -10000: 0.004622 0.005532 0.000910 × 0.83 -10: 0.000050 0.000132 0.000082 × 0.37 tip 0.000052 0.000085 0.000033 × 0.61 0 + (-10000:) 0.028222 0.005337 -0.022885 × 5.29 0 0.023521 0.000084 -0.023437 × 280.01 (-10000:) + 0 0.235539 0.005308 -0.230231 × 44.37 (-10:) + :9 0.232883 0.000180 -0.232703 ×1293.79 (-10000:) + (:99) 0.238735 0.005358 -0.233377 × 44.55 :99 + (-10000:) 0.317942 0.005593 -0.312349 × 56.84 :9 + (-10:) 0.313372 0.000179 -0.313193 ×1750.68 :9 0.316450 0.000143 -0.316307 ×2212.93 On smaller repositories, the cost of nodemap related operation is not as big, so the win is much more modest. Yet it helps shaving a handful of millisecond here and there. Here are some numbers (in seconds) for the reference copy of mercurial: Revset Before After abs-change speedup -10: 0.000065 0.000097 0.000032 × 0.67 tip 0.000063 0.000078 0.000015 × 0.80 0 0.000561 0.000079 -0.000482 × 7.10 -10000: 0.004609 0.003648 -0.000961 × 1.26 0 + (-10000:) 0.005023 0.003715 -0.001307 × 1.35 (-10:) + :9 0.002187 0.000108 -0.002079 ×20.25 (-10000:) + 0 0.006252 0.003716 -0.002536 × 1.68 (-10000:) + (:99) 0.006367 0.003707 -0.002660 × 1.71 :9 + (-10:) 0.003846 0.000110 -0.003736 ×34.96 :9 0.003854 0.000099 -0.003755 ×38.92 :99 + (-10000:) 0.007644 0.003778 -0.003866 × 2.02 Differential Revision: https://phab.mercurial-scm.org/D7894
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 11 Feb 2020 11:18:52 +0100
parents 89630d0b3e23
children
line wrap: on
line source

  $ . "$TESTDIR/histedit-helpers.sh"

  $ cat >> $HGRCPATH <<EOF
  > [alias]
  > tglog = log -G --template "{rev}:{node}:{phase} '{desc}'\n"
  > [extensions]
  > histedit=
  > EOF

Create repo a:

  $ hg init a
  $ cd a
  $ hg unbundle "$TESTDIR/bundles/rebase.hg"
  adding changesets
  adding manifests
  adding file changes
  added 8 changesets with 7 changes to 7 files (+2 heads)
  new changesets cd010b8cd998:02de42196ebe (8 drafts)
  (run 'hg heads' to see heads, 'hg merge' to merge)
  $ hg up tip
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved

  $ hg tglog
  @  7:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  |
  | o  6:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  |/|
  o |  5:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  | |
  | o  4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  | o  3:32af7686d403cf45b5d95f2d70cebea587ac806a:draft 'D'
  | |
  | o  2:5fddd98957c8a54a4d436dfe1da9d87f21a1b97b:draft 'C'
  | |
  | o  1:42ccdea3bb16d28e1848c95fe2e44c000f3f21b1:draft 'B'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
  
Verify that implicit base command and help are listed

  $ HGEDITOR=cat hg histedit |grep base
  #  b, base = checkout changeset and apply further changesets from there

Go to D
  $ hg update 3
  3 files updated, 0 files merged, 2 files removed, 0 files unresolved
edit the history to rebase B onto H


Rebase B onto H
  $ hg histedit 1 --commands - 2>&1 << EOF | fixbundle
  > base 02de42196ebe
  > pick 42ccdea3bb16 B
  > pick 5fddd98957c8 C
  > pick 32af7686d403 D
  > EOF

  $ hg tglog
  @  7:0937e82309df47d14176ee15e45dbec5fbdef340:draft 'D'
  |
  o  6:f778d1cbddac4ab679d9983c9bb92e4c5e09e7fa:draft 'C'
  |
  o  5:3d41b7cc708545206213a842f96d812d2e73d818:draft 'B'
  |
  o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  |
  | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  |/|
  o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  | |
  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
  
Rebase back and drop something
  $ hg histedit 5 --commands - 2>&1 << EOF | fixbundle
  > base cd010b8cd998
  > pick 3d41b7cc7085 B
  > drop f778d1cbddac C
  > pick 0937e82309df D
  > EOF

  $ hg tglog
  @  6:476cc3e4168da2d036b141f7f7dcff7f8e3fe846:draft 'D'
  |
  o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
  |
  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  | |
  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  | |/|
  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  |/ /
  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
  
Split stack
  $ hg histedit 5 --commands - 2>&1 << EOF | fixbundle
  > base cd010b8cd998
  > pick d273e35dcdf2 B
  > base cd010b8cd998
  > pick 476cc3e4168d D
  > EOF

  $ hg tglog
  @  6:d7a6f907a822c4ce6f15662ae45a42aa46d3818a:draft 'D'
  |
  | o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
  |/
  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  | |
  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  | |/|
  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  |/ /
  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
  
Abort
  $ echo x > B
  $ hg add B
  $ hg commit -m "X"
  $ hg tglog
  @  7:591369deedfdcbf57471e894999a70d7f676186d:draft 'X'
  |
  o  6:d7a6f907a822c4ce6f15662ae45a42aa46d3818a:draft 'D'
  |
  | o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
  |/
  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  | |
  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  | |/|
  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  |/ /
  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
  
  $ hg histedit 6 --commands - 2>&1 << EOF | fixbundle
  > base d273e35dcdf2 B
  > drop d7a6f907a822 D
  > pick 591369deedfd X
  > EOF
  merging B
  warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
  Fix up the change (pick 591369deedfd)
  (hg histedit --continue to resume)
  $ hg histedit --abort | fixbundle
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg tglog
  @  7:591369deedfdcbf57471e894999a70d7f676186d:draft 'X'
  |
  o  6:d7a6f907a822c4ce6f15662ae45a42aa46d3818a:draft 'D'
  |
  | o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
  |/
  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  | |
  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  | |/|
  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  |/ /
  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
  
Continue
  $ hg histedit 6 --commands - 2>&1 << EOF | fixbundle
  > base d273e35dcdf2 B
  > drop d7a6f907a822 D
  > pick 591369deedfd X
  > EOF
  merging B
  warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
  Fix up the change (pick 591369deedfd)
  (hg histedit --continue to resume)
  $ echo b2 > B
  $ hg resolve --mark B
  (no more unresolved files)
  continue: hg histedit --continue
  $ hg histedit --continue | fixbundle
  $ hg tglog
  @  6:03772da75548bb42a8f1eacd8c91d0717a147fcd:draft 'X'
  |
  o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
  |
  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  | |
  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  | |/|
  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  |/ /
  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
  

base on a previously picked changeset
  $ echo i > i
  $ hg add i
  $ hg commit -m "I"
  $ echo j > j
  $ hg add j
  $ hg commit -m "J"
  $ hg tglog
  @  8:e8c55b19d366b335626e805484110d1d5f6f2ea3:draft 'J'
  |
  o  7:b2f90fd8aa85db5569e3cfc30cd1d7739546368e:draft 'I'
  |
  o  6:03772da75548bb42a8f1eacd8c91d0717a147fcd:draft 'X'
  |
  o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
  |
  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  | |
  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  | |/|
  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  |/ /
  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'
  
  $ hg histedit 5 --commands - 2>&1 << EOF | fixbundle
  > pick d273e35dcdf2 B
  > pick 03772da75548 X
  > base d273e35dcdf2 B
  > pick e8c55b19d366 J
  > base d273e35dcdf2 B
  > pick b2f90fd8aa85 I
  > EOF
  hg: parse error: base "d273e35dcdf2" changeset was an edited list candidate
  (base must only use unlisted changesets)

  $ hg tglog
  @  8:e8c55b19d366b335626e805484110d1d5f6f2ea3:draft 'J'
  |
  o  7:b2f90fd8aa85db5569e3cfc30cd1d7739546368e:draft 'I'
  |
  o  6:03772da75548bb42a8f1eacd8c91d0717a147fcd:draft 'X'
  |
  o  5:d273e35dcdf21a7eb305192ef2e362887cd0a6f8:draft 'B'
  |
  | o  4:02de42196ebee42ef284b6780a87cdc96e8eaab6:draft 'H'
  | |
  | | o  3:eea13746799a9e0bfd88f29d3c2e9dc9389f524f:draft 'G'
  | |/|
  | o |  2:24b6387c8c8cae37178880f3fa95ded3cb1cf785:draft 'F'
  |/ /
  | o  1:9520eea781bcca16c1e15acc0ba14335a0e8e5ba:draft 'E'
  |/
  o  0:cd010b8cd998f3981a5a8115f94f8da4ab506089:draft 'A'