tests/test-patch-offset.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Tue, 09 Apr 2024 22:37:15 +0200
changeset 51595 3a6fae3bef35
parent 41738 c70bdd222dcd
permissions -rw-r--r--
outgoing: add a simple fastpath when there is no common This further speed up case like `hg bundle --all` for larger repository. ### data-env-vars.name = mozilla-try-2023-03-22-zstd-sparse-revlog # 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 before: 316.749699 after: 311.165461 (-1.76%, -5.58) There is further work to be done in this area like not doing any outgoing computation in the stream case for example. however the recent changes already gives use a large win for a small amount of local work. ### 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 = mercurial-public-2024-03-22-zstd-sparse-revlog pre-%ln-change: 1.263859 the-%ln-change: 0.700229 (-44.60%, -0.56) prev-changeset: 0.496050 (-60.75%, -0.77) this-changeset: 0.495243 (-60.81%, -0.77) ## data-env-vars.name = tryton-public-2024-03-22-zstd-sparse-revlog pre-%ln-change: 2.975765 the-%ln-change: 1.870798 (-37.13%, -1.10) prev-changeset: 1.461583 (-50.88%, -1.51) this-changeset: 1.469185 (-50.63%, -1.51) ## data-env-vars.name = pypy-2024-03-22-zstd-sparse-revlog pre-%ln-change: 4.540080 the-%ln-change: 3.401700 (-25.07%, -1.14) prev-changeset: 2.915810 (-35.78%, -1.62) this-changeset: 2.911643 (-35.87%, -1.63) ## data-env-vars.name = heptapod-public-2024-03-25-zstd-sparse-revlog pre-%ln-change: 10.138396 the-%ln-change: 7.750458 (-23.55%, -2.39) prev-changeset: 6.665565 (-34.25%, -3.47) this-changeset: 6.672078 (-34.19%, -3.47) ## data-env-vars.name = mozilla-try-2023-03-22-zstd-sparse-revlog pre-%ln-change: 399.484481 the-%ln-change: 346.508952 (-13.26%, -52.98) prev-changeset: 316.749699 (-20.71%, -82.73) this-changeset: 311.165461 (-22.11%, -88.32)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10135
9a4034b630c4 patch: better handling of sequence of offset patch hunks (issue1941)
Greg Onufer <gonufer@jazzhaiku.com>
parents:
diff changeset
     1
12477
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
     2
  $ cat > writepatterns.py <<EOF
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
     3
  > import sys
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
     4
  > 
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
     5
  > path = sys.argv[1]
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
     6
  > patterns = sys.argv[2:]
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
     7
  > 
36020
bfc9ab6c1bec py3: replace file() with open() in test-patch-offset.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 32940
diff changeset
     8
  > fp = open(path, 'wb')
12477
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
     9
  > for pattern in patterns:
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    10
  >     count = int(pattern[0:-1])
38365
bf953d218a91 py3: encode sys.argv to bytes using .encode()
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36020
diff changeset
    11
  >     char = pattern[-1].encode('utf8') + b'\n'
41738
c70bdd222dcd tests: bulk changes to avoid whitespace errors of check-code.py
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 39707
diff changeset
    12
  >     fp.write(char * count)
12477
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    13
  > fp.close()
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    14
  > EOF
10135
9a4034b630c4 patch: better handling of sequence of offset patch hunks (issue1941)
Greg Onufer <gonufer@jazzhaiku.com>
parents:
diff changeset
    15
12477
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    16
prepare repo
10135
9a4034b630c4 patch: better handling of sequence of offset patch hunks (issue1941)
Greg Onufer <gonufer@jazzhaiku.com>
parents:
diff changeset
    17
12477
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    18
  $ hg init a
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    19
  $ cd a
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    20
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    21
These initial lines of Xs were not in the original file used to generate
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    22
the patch.  So all the patch hunks need to be applied to a constant offset
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    23
within this file.  If the offset isn't tracked then the hunks can be
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    24
applied to the wrong lines of this file.
10135
9a4034b630c4 patch: better handling of sequence of offset patch hunks (issue1941)
Greg Onufer <gonufer@jazzhaiku.com>
parents:
diff changeset
    25
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 38365
diff changeset
    26
  $ "$PYTHON" ../writepatterns.py a 34X 10A 1B 10A 1C 10A 1B 10A 1D 10A 1B 10A 1E 10A 1B 10A
12477
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    27
  $ hg commit -Am adda
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    28
  adding a
10135
9a4034b630c4 patch: better handling of sequence of offset patch hunks (issue1941)
Greg Onufer <gonufer@jazzhaiku.com>
parents:
diff changeset
    29
12477
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    30
This is a cleaner patch generated via diff
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    31
In this case it reproduces the problem when
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    32
the output of hg export does not
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    33
import patch
10135
9a4034b630c4 patch: better handling of sequence of offset patch hunks (issue1941)
Greg Onufer <gonufer@jazzhaiku.com>
parents:
diff changeset
    34
12477
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    35
  $ hg import -v -m 'b' -d '2 0' - <<EOF
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    36
  > --- a/a	2009-12-08 19:26:17.000000000 -0800
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    37
  > +++ b/a	2009-12-08 19:26:17.000000000 -0800
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    38
  > @@ -9,7 +9,7 @@
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    39
  >  A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    40
  >  A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    41
  >  B
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    42
  > -A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    43
  > +a
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    44
  >  A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    45
  >  A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    46
  >  A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    47
  > @@ -53,7 +53,7 @@
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    48
  >  A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    49
  >  A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    50
  >  B
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    51
  > -A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    52
  > +a
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    53
  >  A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    54
  >  A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    55
  >  A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    56
  > @@ -75,7 +75,7 @@
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    57
  >  A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    58
  >  A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    59
  >  B
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    60
  > -A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    61
  > +a
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    62
  >  A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    63
  >  A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    64
  >  A
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    65
  > EOF
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    66
  applying patch from stdin
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    67
  patching file a
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    68
  Hunk #1 succeeded at 43 (offset 34 lines).
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    69
  Hunk #2 succeeded at 87 (offset 34 lines).
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    70
  Hunk #3 succeeded at 109 (offset 34 lines).
23749
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 16913
diff changeset
    71
  committing files:
12477
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    72
  a
23749
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 16913
diff changeset
    73
  committing manifest
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 16913
diff changeset
    74
  committing changelog
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 12477
diff changeset
    75
  created 189885cecb41
10135
9a4034b630c4 patch: better handling of sequence of offset patch hunks (issue1941)
Greg Onufer <gonufer@jazzhaiku.com>
parents:
diff changeset
    76
12477
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    77
compare imported changes against reference file
10135
9a4034b630c4 patch: better handling of sequence of offset patch hunks (issue1941)
Greg Onufer <gonufer@jazzhaiku.com>
parents:
diff changeset
    78
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 38365
diff changeset
    79
  $ "$PYTHON" ../writepatterns.py aref 34X 10A 1B 1a 9A 1C 10A 1B 10A 1D 10A 1B 1a 9A 1E 10A 1B 1a 9A
12477
e68cd3a90599 tests: unify test-patch-offset
Matt Mackall <mpm@selenic.com>
parents: 10265
diff changeset
    80
  $ diff aref a
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 15194
diff changeset
    81
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 15194
diff changeset
    82
  $ cd ..