tests/test-rebase-brute-force.t
author Jun Wu <quark@fb.com>
Sun, 06 Aug 2017 11:40:53 -0700
changeset 33708 71b77b61ed60
child 33786 0975506120fb
permissions -rw-r--r--
test-rebase: add a brute force test Rebase is becoming more complex and it looks like a good idea to try some brute force enumeration to cover cases that are hard to find manually. Using brute force to generate repos in different shapes and enumerating the rebase source and destination would generate too many cases that takes too long to compute. This patch limits the "brute force" to only the "rebase source" part. Repo and destination are still manual. The added test cases are crafted manually to reveal some behaviors that are not covered by other tests: - "revlog index out of range" crash - after rebase, p1 == p2, p2 != null - "nothing to merge" abort In the future we might want to add more tests here. For now I'm more interested in revealing interesting behaviors in a minified way. I tried some more complex cases but didn't find other interesting behaviors. Differential Revision: https://phab.mercurial-scm.org/D262

  $ cat >> $HGRCPATH <<EOF
  > [extensions]
  > drawdag=$TESTDIR/drawdag.py
  > bruterebase=$TESTDIR/bruterebase.py
  > [experimental]
  > evolution=createmarkers,allowunstable
  > EOF
  $ init() {
  >   N=`expr ${N:-0} + 1`
  >   cd $TESTTMP && hg init repo$N && cd repo$N
  >   hg debugdrawdag
  > }

Source looks like "N"

  $ init <<'EOS'
  > C D
  > |\|
  > A B Z
  > EOS

  $ hg debugbruterebase 'all()-Z' Z
     A: A':Z
     B: B':Z
    AB: A':Z B':Z
     C: ABORT: cannot use revision 3 as base, result would have 3 parents
    AC: A':Z C':A'B
    BC: B':Z C':B'A
   ABC: A':Z B':Z C':A'B'
     D: D':Z
    AD: A':Z D':Z
    BD: B':Z D':B'
   ABD: A':Z B':Z D':B'
    CD: CRASH: revlog index out of range
   ACD: A':Z C':A'A' D':Z
   BCD: B':Z C':B'A D':B'
  ABCD: A':Z B':Z C':A'B' D':B'

Moving backwards

  $ init <<'EOS'
  > C
  > |\
  > A B
  > |
  > Z
  > EOS
  $ hg debugbruterebase 'all()-Z' Z
    B: B':Z
    A: 
   BA: B':Z
    C: ABORT: cannot use revision 3 as base, result would have 3 parents
   BC: B':Z C':B'A
   AC: 
  BAC: ABORT: nothing to merge