D6351: tests: update annotate tests to work around simplemerge bug

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Tue May 7 01:26:02 EDT 2019


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  test-annotate.t and test-fastannotate.hg were failing with --pure
  since https://phab.mercurial-scm.org/rHG57203e0210f832b34438534770a583de35d0d6c6 (copies: calculate mergecopies() based on
  pathcopies(), 2019-04-11). It turned out to be because the pure file
  merge code behaved differently. I'm guessing it's the
  mdiff.get_matching_blocks() that behaves differently, but I haven't
  confirmed that.
  
  With this content in the base:
  
    a
    a
    a
  
  And this on the local side:
  
    a
    z
    a
  
  And this on the other side:
  
    a
    a
    a
    b4
    c
    b6
  
  It produced this conflict:
  
    a
    z
    a
    <<<<<<< working copy: b80e3e32f75a - test: c
    ||||||| base
    a
    =======
    a
    b4
    c
    b5
    >>>>>>> merge rev:    64afcdf8e29e - test: mergeb
  
  I don't care enough about the pure Python code to fix it, so this
  patch just updates the tests to help the file merge algorithm find the
  same answer in pure and native code.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6351

AFFECTED FILES
  tests/test-annotate.t
  tests/test-fastannotate-hg.t

CHANGE DETAILS

diff --git a/tests/test-fastannotate-hg.t b/tests/test-fastannotate-hg.t
--- a/tests/test-fastannotate-hg.t
+++ b/tests/test-fastannotate-hg.t
@@ -84,7 +84,7 @@
 
   $ cat <<EOF >>a
   > a
-  > a
+  > a3
   > EOF
   $ hg ci -ma1 -d '1 0'
   $ hg cp a b
@@ -101,7 +101,7 @@
   $ hg annotate -n b
   0: a
   1: a
-  1: a
+  1: a3
   3: b4
   3: b5
   3: b6
@@ -111,7 +111,7 @@
   $ hg annotate --no-follow b
   2: a
   2: a
-  2: a
+  2: a3
   3: b4
   3: b5
   3: b6
@@ -121,7 +121,7 @@
   $ hg annotate -nl b
   0:1: a
   1:2: a
-  1:3: a
+  1:3: a3
   3:4: b4
   3:5: b5
   3:6: b6
@@ -131,7 +131,7 @@
   $ hg annotate -nf b
   0 a: a
   1 a: a
-  1 a: a
+  1 a: a3
   3 b: b4
   3 b: b5
   3 b: b6
@@ -141,7 +141,7 @@
   $ hg annotate -nlf b
   0 a:1: a
   1 a:2: a
-  1 a:3: a
+  1 a:3: a3
   3 b:4: b4
   3 b:5: b5
   3 b:6: b6
@@ -164,21 +164,21 @@
   $ cat b
   a
   a
-  a
-  <<<<<<< working copy: 5fbdc1152d97 - test: b2.1
+  a3
+  <<<<<<< working copy: 5b11d30c501c - test: b2.1
   b4
   c
   b5
   ||||||| base
   =======
   b4
   b5
   b6
-  >>>>>>> merge rev:    37ec9f5c3d1f - test: b2
+  >>>>>>> merge rev:    00283b69e93a - test: b2
   $ cat <<EOF > b
   > a
   > a
-  > a
+  > a3
   > b4
   > c
   > b5
@@ -195,7 +195,7 @@
   fastannotate: b: 5 new changesets in the main branch
   0 a: a
   1 a: a
-  1 a: a
+  1 a: a3
   3 b: b4
   4 b: c
   3 b: b5
@@ -206,40 +206,40 @@
   fastannotate: b: using fast path (resolved fctx: False)
   0 a: a
   1 a: a
-  1 a: a
+  1 a: a3
   4 b: b4
   4 b: c
   4 b: b5
 
 annotate after merge with -l
 (fastannotate differs from annotate)
 
   $ hg log -Gp -T '{rev}:{node}' -r '2..5'
-  @    5:64afcdf8e29e063c635be123d8d2fb160af00f7e
+  @    5:90287468742e2e0246cb6367db2041531ce70103
   |\
-  | o  4:5fbdc1152d97597717021ad9e063061b200f146bdiff --git a/b b/b
+  | o  4:5b11d30c501ca9f279ad7fbe6bd6cfb24914ee59diff --git a/b b/b
   | |  --- a/b
   | |  +++ b/b
   | |  @@ -1,3 +1,6 @@
   | |   a
   | |   a
-  | |   a
+  | |   a3
   | |  +b4
   | |  +c
   | |  +b5
   | |
-  o |  3:37ec9f5c3d1f99572d7075971cb4876e2139b52fdiff --git a/b b/b
+  o |  3:00283b69e93aa814ca9b86460c411015405fb19adiff --git a/b b/b
   |/   --- a/b
   |    +++ b/b
   |    @@ -1,3 +1,6 @@
   |     a
   |     a
-  |     a
+  |     a3
   |    +b4
   |    +b5
   |    +b6
   |
-  o  2:3086dbafde1ce745abfc8d2d367847280aabae9ddiff --git a/a b/b
+  o  2:6ad008faa136fdf083e91083a4aa4e6e18b5e8c4diff --git a/a b/b
   |  copy from a
   ~  copy to b
   
@@ -250,15 +250,15 @@
   $ hg annotate -nlf b --config fastannotate.modes=
   0 a:1: a
   1 a:2: a
-  1 a:3: a
+  1 a:3: a3
   3 b:4: b4
   4 b:5: c
   3 b:5: b5
 
   $ hg annotate -nlf b
   0 a:1: a
   1 a:2: a
-  1 a:3: a
+  1 a:3: a3
   4 b:4: b4
   4 b:5: c
   4 b:6: b5
@@ -269,7 +269,7 @@
   $ cat <<EOF > b
   > a
   > z
-  > a
+  > a3
   > EOF
   $ hg ci -mc -d '3 0'
   created new head
@@ -285,7 +285,7 @@
   $ hg annotate -nf b
   0 a: a
   6 b: z
-  1 a: a
+  1 a: a3
   3 b: b4
   4 b: c
   3 b: b5
@@ -295,37 +295,38 @@
 (fastannotate differs from annotate)
 
   $ hg log -Gp -T '{rev}:{node}' -r '0+1+6+7'
-  @    7:6284bb6c38fef984a929862a53bbc71ce9eafa81diff --git a/b b/b
+  @    7:8868d0fca4d2d22079990f4a772d0af2664d35fediff --git a/b b/b
   |\   --- a/b
   | :  +++ b/b
   | :  @@ -1,3 +1,7 @@
   | :   a
   | :   z
-  | :   a
+  | :   a3
   | :  +b4
   | :  +c
   | :  +b5
   | :  +d
   | :
-  o :  6:b80e3e32f75a6a67cd4ac85496a11511e9112816diff --git a/a b/b
+  o :  6:189fc23b8ce7bbf4dc1bba9e52c4bfdb38922ad9diff --git a/a b/b
   :/   copy from a
   :    copy to b
   :    --- a/a
   :    +++ b/b
   :    @@ -1,3 +1,3 @@
   :    -a (?)
   :     a
+  :    -a
   :    +z
-  :     a
   :    -a (?)
+  :     a3
   :
-  o  1:762f04898e6684ff713415f7b8a8d53d33f96c92diff --git a/a b/a
+  o  1:151465fa4cb9d404da352ad0bdef38aa2020dc37diff --git a/a b/a
   |  --- a/a
   |  +++ b/a
   |  @@ -1,1 +1,3 @@
   |   a
   |  +a
-  |  +a
+  |  +a3
   |
   o  0:8435f90966e442695d2ded29fdade2bac5ad8065diff --git a/a b/a
      new file mode 100644
@@ -358,7 +359,7 @@
   $ hg annotate -nlf b --config fastannotate.modes=
   0 a:1: a
   6 b:2: z
-  1 a:3: a
+  1 a:3: a3
   3 b:4: b4
   4 b:5: c
   3 b:5: b5
@@ -370,6 +371,7 @@
   6 b:2: z
   1 a:2: a (?)
   1 a:3: a (?)
+  1 a:3: a3
   3 b:4: b4
   4 b:5: c
   3 b:5: b5
@@ -390,6 +392,7 @@
    6 b: 2: z
    1 a: 2: a (?)
    1 a: 3: a (?)
+   1 a: 3: a3
    3 b: 4: b4
    4 b: 5: c
    3 b: 5: b5
@@ -403,14 +406,14 @@
   $ hg annotate -r tip -n a
   0: a
   1: a
-  1: a
+  1: a3
 
 linkrev vs rev with -l
 
   $ hg annotate -r tip -nl a
   0:1: a
   1:2: a
-  1:3: a
+  1:3: a3
 
 Issue589: "undelete" sequence leads to crash
 
@@ -436,7 +439,7 @@
 missing file
 
   $ hg ann nosuchfile
-  abort: nosuchfile: no such file in rev e9e6b4fa872f
+  abort: nosuchfile: no such file in rev 4bb0cf7b70e4
   [255]
 
 annotate file without '\n' on last line
@@ -562,7 +565,7 @@
 annotate clean file
 
   $ hg annotate -ncr "wdir()" foo
-  11 472b18db256d : foo
+  11 d52714cca963 : foo
 
 annotate modified file
 
@@ -572,25 +575,25 @@
   20+: foofoo
 
   $ hg annotate -cr "wdir()" foo
-  472b18db256d : foo
-  b6bedd5477e7+: foofoo
+  d52714cca963 : foo
+  3435b4560d2c+: foofoo
 
   $ hg annotate -ncr "wdir()" foo
-  11 472b18db256d : foo
-  20 b6bedd5477e7+: foofoo
+  11 d52714cca963 : foo
+  20 3435b4560d2c+: foofoo
 
   $ hg annotate --debug -ncr "wdir()" foo
-  11 472b18db256d1e8282064eab4bfdaf48cbfe83cd : foo
-  20 b6bedd5477e797f25e568a6402d4697f3f895a72+: foofoo
+  11 d52714cca963b6bb9b945743d1fbee072d1f3bd9 : foo
+  20 3435b4560d2cf6aa2bb09bcb5aa12ac15d8ba9ef+: foofoo
 
   $ hg annotate -udr "wdir()" foo
   test Thu Jan 01 00:00:00 1970 +0000: foo
   test [A-Za-z0-9:+ ]+: foofoo (re)
 
   $ hg annotate -ncr "wdir()" -Tjson foo
   [
    {
-    "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": "ffffffffffffffffffffffffffffffffffffffff", "rev": 2147483647}],
+    "lines": [{"line": "foo\n", "node": "d52714cca963b6bb9b945743d1fbee072d1f3bd9", "rev": 11}, {"line": "foofoo\n", "node": "ffffffffffffffffffffffffffffffffffffffff", "rev": 2147483647}],
     "path": "foo"
    }
   ]
@@ -600,14 +603,14 @@
   $ echo bar > bar
   $ hg add bar
   $ hg annotate -ncr "wdir()" bar
-  20 b6bedd5477e7+: bar
+  20 3435b4560d2c+: bar
 
 annotate renamed file
 
   $ hg rename foo renamefoo2
   $ hg annotate -ncr "wdir()" renamefoo2
-  11 472b18db256d : foo
-  20 b6bedd5477e7+: foofoo
+  11 d52714cca963 : foo
+  20 3435b4560d2c+: foofoo
 
 annotate missing file
 
diff --git a/tests/test-annotate.t b/tests/test-annotate.t
--- a/tests/test-annotate.t
+++ b/tests/test-annotate.t
@@ -87,7 +87,7 @@
 
   $ cat <<EOF >>a
   > a
-  > a
+  > a3
   > EOF
   $ hg ci -ma1 -d '1 0'
   $ hg cp a b
@@ -104,35 +104,35 @@
   $ hg annotate -T'{lines}' a
   0: a
   1: a
-  1: a
+  1: a3
   $ hg annotate -T'{join(lines, "\n")}' a
   0: a
   
   1: a
   
-  1: a
+  1: a3
 
 several filters can be applied to '{lines}'
 
   $ hg annotate -T'{lines|json}\n' a
-  [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}]
+  [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a3\n", "rev": 1}]
   $ hg annotate -T'{lines|stringify}' a
   0: a
   1: a
-  1: a
+  1: a3
   $ hg annotate -T'{lines|count}\n' a
   3
 
 annotate multiple files (JSON)
 
   $ hg annotate -Tjson a b
   [
    {
-    "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}],
+    "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a3\n", "rev": 1}],
     "path": "a"
    },
    {
-    "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}, {"line": "b4\n", "rev": 3}, {"line": "b5\n", "rev": 3}, {"line": "b6\n", "rev": 3}],
+    "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a3\n", "rev": 1}, {"line": "b4\n", "rev": 3}, {"line": "b5\n", "rev": 3}, {"line": "b6\n", "rev": 3}],
     "path": "b"
    }
   ]
@@ -143,11 +143,11 @@
   == a ==
   0: a
   1: a
-  1: a
+  1: a3
   == b ==
   0: a
   1: a
-  1: a
+  1: a3
   3: b4
   3: b5
   3: b6
@@ -157,7 +157,7 @@
   $ hg annotate -n b
   0: a
   1: a
-  1: a
+  1: a3
   3: b4
   3: b5
   3: b6
@@ -167,7 +167,7 @@
   $ hg annotate --no-follow b
   2: a
   2: a
-  2: a
+  2: a3
   3: b4
   3: b5
   3: b6
@@ -177,7 +177,7 @@
   $ hg annotate -nl b
   0:1: a
   1:2: a
-  1:3: a
+  1:3: a3
   3:4: b4
   3:5: b5
   3:6: b6
@@ -187,7 +187,7 @@
   $ hg annotate -nf b
   0 a: a
   1 a: a
-  1 a: a
+  1 a: a3
   3 b: b4
   3 b: b5
   3 b: b6
@@ -197,7 +197,7 @@
   $ hg annotate -nlf b
   0 a:1: a
   1 a:2: a
-  1 a:3: a
+  1 a:3: a3
   3 b:4: b4
   3 b:5: b5
   3 b:6: b6
@@ -220,21 +220,21 @@
   $ cat b
   a
   a
-  a
-  <<<<<<< working copy: 5fbdc1152d97 - test: b2.1
+  a3
+  <<<<<<< working copy: 5b11d30c501c - test: b2.1
   b4
   c
   b5
   ||||||| base
   =======
   b4
   b5
   b6
-  >>>>>>> merge rev:    37ec9f5c3d1f - test: b2
+  >>>>>>> merge rev:    00283b69e93a - test: b2
   $ cat <<EOF > b
   > a
   > a
-  > a
+  > a3
   > b4
   > c
   > b5
@@ -248,7 +248,7 @@
   $ hg annotate -nf b
   0 a: a
   1 a: a
-  1 a: a
+  1 a: a3
   3 b: b4
   4 b: c
   3 b: b5
@@ -258,7 +258,7 @@
   $ hg annotate -nlf b
   0 a:1: a
   1 a:2: a
-  1 a:3: a
+  1 a:3: a3
   3 b:4: b4
   4 b:5: c
   3 b:5: b5
@@ -269,7 +269,7 @@
   $ cat <<EOF > b
   > a
   > z
-  > a
+  > a3
   > EOF
   $ hg ci -mc -d '3 0'
   created new head
@@ -285,7 +285,7 @@
   $ hg annotate -nf b
   0 a: a
   6 b: z
-  1 a: a
+  1 a: a3
   3 b: b4
   4 b: c
   3 b: b5
@@ -296,7 +296,7 @@
   $ hg annotate -nlf b
   0 a:1: a
   6 b:2: z
-  1 a:3: a
+  1 a:3: a3
   3 b:4: b4
   4 b:5: c
   3 b:5: b5
@@ -307,20 +307,18 @@
   $ hg annotate -nlf b --skip '1::0'
   0 a:1: a
   6 b:2: z
-  1 a:3: a
+  1 a:3: a3
   3 b:4: b4
   4 b:5: c
   3 b:5: b5
   7 b:7: d
 
---skip a modified line. Note a slight behavior difference in pure - this is
-because the pure code comes up with slightly different deltas internally.
+--skip a modified line
 
   $ hg annotate -nlf b --skip 6
   0 a:1: a
-  1 a:2* z (no-pure !)
-  0 a:1* z (pure !)
-  1 a:3: a
+  1 a:2* z
+  1 a:3: a3
   3 b:4: b4
   4 b:5: c
   3 b:5: b5
@@ -331,34 +329,34 @@
   $ hg annotate -nlf b --skip 3
   0 a:1: a
   6 b:2: z
-  1 a:3: a
+  1 a:3: a3
   1 a:3* b4
   4 b:5: c
   1 a:3* b5
   7 b:7: d
 
   $ hg annotate -nlf b --skip 4
   0 a:1: a
   6 b:2: z
-  1 a:3: a
+  1 a:3: a3
   3 b:4: b4
   1 a:3* c
   3 b:5: b5
   7 b:7: d
 
   $ hg annotate -nlf b --skip 3 --skip 4
   0 a:1: a
   6 b:2: z
-  1 a:3: a
+  1 a:3: a3
   1 a:3* b4
   1 a:3* c
   1 a:3* b5
   7 b:7: d
 
   $ hg annotate -nlf b --skip 'merge()'
   0 a:1: a
   6 b:2: z
-  1 a:3: a
+  1 a:3: a3
   3 b:4: b4
   4 b:5: c
   3 b:5: b5
@@ -369,7 +367,7 @@
   $ hg annotate -nlf b --skip 'all()'
   0 a:1: a
   0 a:1* z
-  0 a:1* a
+  0 a:1* a3
   0 a:1* b4
   0 a:1* c
   0 a:1* b5
@@ -386,7 +384,7 @@
   $ hg annotate -nlf b
    0 a: 1: a
    6 b: 2: z
-   1 a: 3: a
+   1 a: 3: a3
    3 b: 4: b4
    4 b: 5: c
    3 b: 5: b5
@@ -400,14 +398,14 @@
   $ hg annotate -r tip -n a
   0: a
   1: a
-  1: a
+  1: a3
 
 linkrev vs rev with -l
 
   $ hg annotate -r tip -nl a
   0:1: a
   1:2: a
-  1:3: a
+  1:3: a3
 
 Issue589: "undelete" sequence leads to crash
 
@@ -433,7 +431,7 @@
 missing file
 
   $ hg ann nosuchfile
-  abort: nosuchfile: no such file in rev e9e6b4fa872f
+  abort: nosuchfile: no such file in rev 4bb0cf7b70e4
   [255]
 
 annotate file without '\n' on last line
@@ -560,7 +558,7 @@
 annotate clean file
 
   $ hg annotate -ncr "wdir()" foo
-  11 472b18db256d : foo
+  11 d52714cca963 : foo
 
 annotate modified file
 
@@ -570,25 +568,25 @@
   20+: foofoo
 
   $ hg annotate -cr "wdir()" foo
-  472b18db256d : foo
-  b6bedd5477e7+: foofoo
+  d52714cca963 : foo
+  3435b4560d2c+: foofoo
 
   $ hg annotate -ncr "wdir()" foo
-  11 472b18db256d : foo
-  20 b6bedd5477e7+: foofoo
+  11 d52714cca963 : foo
+  20 3435b4560d2c+: foofoo
 
   $ hg annotate --debug -ncr "wdir()" foo
-  11 472b18db256d1e8282064eab4bfdaf48cbfe83cd : foo
-  20 b6bedd5477e797f25e568a6402d4697f3f895a72+: foofoo
+  11 d52714cca963b6bb9b945743d1fbee072d1f3bd9 : foo
+  20 3435b4560d2cf6aa2bb09bcb5aa12ac15d8ba9ef+: foofoo
 
   $ hg annotate -udr "wdir()" foo
   test Thu Jan 01 00:00:00 1970 +0000: foo
   test [A-Za-z0-9:+ ]+: foofoo (re)
 
   $ hg annotate -ncr "wdir()" -Tjson foo
   [
    {
-    "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": "ffffffffffffffffffffffffffffffffffffffff", "rev": 2147483647}],
+    "lines": [{"line": "foo\n", "node": "d52714cca963b6bb9b945743d1fbee072d1f3bd9", "rev": 11}, {"line": "foofoo\n", "node": "ffffffffffffffffffffffffffffffffffffffff", "rev": 2147483647}],
     "path": "foo"
    }
   ]
@@ -598,14 +596,14 @@
   $ echo bar > bar
   $ hg add bar
   $ hg annotate -ncr "wdir()" bar
-  20 b6bedd5477e7+: bar
+  20 3435b4560d2c+: bar
 
 annotate renamed file
 
   $ hg rename foo renamefoo2
   $ hg annotate -ncr "wdir()" renamefoo2
-  11 472b18db256d : foo
-  20 b6bedd5477e7+: foofoo
+  11 d52714cca963 : foo
+  20 3435b4560d2c+: foofoo
 
 annotate missing file
 
@@ -728,16 +726,16 @@
   0
   1 baz:1
   2 baz:2
-  <<<<<<< working copy: 863de62655ef - test: baz:3+->3-
+  <<<<<<< working copy: 947cbfbb62c3 - test: baz:3+->3-
   3- baz:3
   4 baz:4
   ||||||| base
   3+ baz:3
   4 baz:4
   =======
   3+ baz:3
   4+ baz:4
-  >>>>>>> merge rev:    cb8df70ae185 - test: qux:4->4+
+  >>>>>>> merge rev:    e8af2f3d2d91 - test: qux:4->4+
   5
   6
   7
@@ -775,16 +773,16 @@
   0
   1 baz:1
   2 baz:2
-  <<<<<<< working copy: cb8df70ae185 - test: qux:4->4+
+  <<<<<<< working copy: e8af2f3d2d91 - test: qux:4->4+
   3+ baz:3
   4+ baz:4
   ||||||| base
   3+ baz:3
   4 baz:4
   =======
   3- baz:3
   4 baz:4
-  >>>>>>> merge rev:    863de62655ef - test: baz:3+->3-
+  >>>>>>> merge rev:    947cbfbb62c3 - test: baz:3+->3-
   5
   6
   7
@@ -901,7 +899,7 @@
 An integer as a line range, which is parsed as '1:1'
 
   $ hg log -r 'followlines(baz, 1)'
-  changeset:   22:2174d0bf352a
+  changeset:   22:43fc27bf31ab
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     added two lines with 0



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list