tests/test-rebase-base.t
changeset 34504 8cef8f7d51d0
parent 34503 0d5a1175d0f9
child 34505 91250ff7d48a
equal deleted inserted replaced
34503:0d5a1175d0f9 34504:8cef8f7d51d0
     1   $ cat >> $HGRCPATH <<EOF
       
     2   > [extensions]
       
     3   > rebase=
       
     4   > drawdag=$TESTDIR/drawdag.py
       
     5   > 
       
     6   > [phases]
       
     7   > publish=False
       
     8   > 
       
     9   > [alias]
       
    10   > tglog = log -G --template "{rev}: {desc}"
       
    11   > EOF
       
    12 
       
    13   $ rebasewithdag() {
       
    14   >   N=`$PYTHON -c "print($N+1)"`
       
    15   >   hg init repo$N && cd repo$N
       
    16   >   hg debugdrawdag
       
    17   >   hg rebase "$@" > _rebasetmp
       
    18   >   r=$?
       
    19   >   grep -v 'saved backup bundle' _rebasetmp
       
    20   >   [ $r -eq 0 ] && hg tglog
       
    21   >   cd ..
       
    22   >   return $r
       
    23   > }
       
    24 
       
    25 Single branching point, without merge:
       
    26 
       
    27   $ rebasewithdag -b D -d Z <<'EOS'
       
    28   >     D E
       
    29   >     |/
       
    30   > Z B C   # C: branching point, E should be picked
       
    31   >  \|/    # B should not be picked
       
    32   >   A
       
    33   >   |
       
    34   >   R
       
    35   > EOS
       
    36   rebasing 3:d6003a550c2c "C" (C)
       
    37   rebasing 5:4526cf523425 "D" (D)
       
    38   rebasing 6:b296604d9846 "E" (E tip)
       
    39   o  6: E
       
    40   |
       
    41   | o  5: D
       
    42   |/
       
    43   o  4: C
       
    44   |
       
    45   o  3: Z
       
    46   |
       
    47   | o  2: B
       
    48   |/
       
    49   o  1: A
       
    50   |
       
    51   o  0: R
       
    52   
       
    53 Multiple branching points caused by selecting a single merge changeset:
       
    54 
       
    55   $ rebasewithdag -b E -d Z <<'EOS'
       
    56   >     E
       
    57   >    /|
       
    58   >   B C D  # B, C: multiple branching points
       
    59   >   | |/   # D should not be picked
       
    60   > Z | /
       
    61   >  \|/
       
    62   >   A
       
    63   >   |
       
    64   >   R
       
    65   > EOS
       
    66   rebasing 2:c1e6b162678d "B" (B)
       
    67   rebasing 3:d6003a550c2c "C" (C)
       
    68   rebasing 6:54c8f00cb91c "E" (E tip)
       
    69   o    6: E
       
    70   |\
       
    71   | o  5: C
       
    72   | |
       
    73   o |  4: B
       
    74   |/
       
    75   o  3: Z
       
    76   |
       
    77   | o  2: D
       
    78   |/
       
    79   o  1: A
       
    80   |
       
    81   o  0: R
       
    82   
       
    83 Rebase should not extend the "--base" revset using "descendants":
       
    84 
       
    85   $ rebasewithdag -b B -d Z <<'EOS'
       
    86   >     E
       
    87   >    /|
       
    88   > Z B C  # descendants(B) = B+E. With E, C will be included incorrectly
       
    89   >  \|/
       
    90   >   A
       
    91   >   |
       
    92   >   R
       
    93   > EOS
       
    94   rebasing 2:c1e6b162678d "B" (B)
       
    95   rebasing 5:54c8f00cb91c "E" (E tip)
       
    96   o    5: E
       
    97   |\
       
    98   | o  4: B
       
    99   | |
       
   100   | o  3: Z
       
   101   | |
       
   102   o |  2: C
       
   103   |/
       
   104   o  1: A
       
   105   |
       
   106   o  0: R
       
   107   
       
   108 Rebase should not simplify the "--base" revset using "roots":
       
   109 
       
   110   $ rebasewithdag -b B+E -d Z <<'EOS'
       
   111   >     E
       
   112   >    /|
       
   113   > Z B C  # roots(B+E) = B. Without E, C will be missed incorrectly
       
   114   >  \|/
       
   115   >   A
       
   116   >   |
       
   117   >   R
       
   118   > EOS
       
   119   rebasing 2:c1e6b162678d "B" (B)
       
   120   rebasing 3:d6003a550c2c "C" (C)
       
   121   rebasing 5:54c8f00cb91c "E" (E tip)
       
   122   o    5: E
       
   123   |\
       
   124   | o  4: C
       
   125   | |
       
   126   o |  3: B
       
   127   |/
       
   128   o  2: Z
       
   129   |
       
   130   o  1: A
       
   131   |
       
   132   o  0: R
       
   133   
       
   134 The destination is one of the two branching points of a merge:
       
   135 
       
   136   $ rebasewithdag -b F -d Z <<'EOS'
       
   137   >     F
       
   138   >    / \
       
   139   >   E   D
       
   140   >  /   /
       
   141   > Z   C
       
   142   >  \ /
       
   143   >   B
       
   144   >   |
       
   145   >   A
       
   146   > EOS
       
   147   nothing to rebase
       
   148   [1]
       
   149 
       
   150 Multiple branching points caused by multiple bases (issue5420):
       
   151 
       
   152   $ rebasewithdag -b E1+E2+C2+B1 -d Z <<'EOS'
       
   153   >   Z    E2
       
   154   >   |   /
       
   155   >   F E1 C2
       
   156   >   |/  /
       
   157   >   E C1 B2
       
   158   >   |/  /
       
   159   >   C B1
       
   160   >   |/
       
   161   >   B
       
   162   >   |
       
   163   >   A
       
   164   >   |
       
   165   >   R
       
   166   > EOS
       
   167   rebasing 3:a113dbaa660a "B1" (B1)
       
   168   rebasing 5:06ce7b1cc8c2 "B2" (B2)
       
   169   rebasing 6:0ac98cce32d3 "C1" (C1)
       
   170   rebasing 8:781512f5e33d "C2" (C2)
       
   171   rebasing 9:428d8c18f641 "E1" (E1)
       
   172   rebasing 11:e1bf82f6b6df "E2" (E2)
       
   173   o  12: E2
       
   174   |
       
   175   o  11: E1
       
   176   |
       
   177   | o  10: C2
       
   178   | |
       
   179   | o  9: C1
       
   180   |/
       
   181   | o  8: B2
       
   182   | |
       
   183   | o  7: B1
       
   184   |/
       
   185   o  6: Z
       
   186   |
       
   187   o  5: F
       
   188   |
       
   189   o  4: E
       
   190   |
       
   191   o  3: C
       
   192   |
       
   193   o  2: B
       
   194   |
       
   195   o  1: A
       
   196   |
       
   197   o  0: R
       
   198   
       
   199 Multiple branching points with multiple merges:
       
   200 
       
   201   $ rebasewithdag -b G+P -d Z <<'EOS'
       
   202   > G   H   P
       
   203   > |\ /|   |\
       
   204   > F E D   M N
       
   205   >  \|/|  /| |\
       
   206   > Z C B I J K L
       
   207   >  \|/  |/  |/
       
   208   >   A   A   A
       
   209   > EOS
       
   210   rebasing 2:dc0947a82db8 "C" (C)
       
   211   rebasing 8:4e4f9194f9f1 "D" (D)
       
   212   rebasing 9:03ca77807e91 "E" (E)
       
   213   rebasing 10:afc707c82df0 "F" (F)
       
   214   rebasing 13:690dfff91e9e "G" (G)
       
   215   rebasing 14:2893b886bb10 "H" (H)
       
   216   rebasing 3:08ebfeb61bac "I" (I)
       
   217   rebasing 4:a0a5005cec67 "J" (J)
       
   218   rebasing 5:83780307a7e8 "K" (K)
       
   219   rebasing 6:e131637a1cb6 "L" (L)
       
   220   rebasing 11:d1f6d0c3c7e4 "M" (M)
       
   221   rebasing 12:7aaec6f81888 "N" (N)
       
   222   rebasing 15:325bc8f1760d "P" (P tip)
       
   223   o    15: P
       
   224   |\
       
   225   | o    14: N
       
   226   | |\
       
   227   o \ \    13: M
       
   228   |\ \ \
       
   229   | | | o  12: L
       
   230   | | | |
       
   231   | | o |  11: K
       
   232   | | |/
       
   233   | o /  10: J
       
   234   | |/
       
   235   o /  9: I
       
   236   |/
       
   237   | o    8: H
       
   238   | |\
       
   239   | | | o  7: G
       
   240   | | |/|
       
   241   | | | o  6: F
       
   242   | | | |
       
   243   | | o |  5: E
       
   244   | | |/
       
   245   | o |  4: D
       
   246   | |\|
       
   247   +---o  3: C
       
   248   | |
       
   249   o |  2: Z
       
   250   | |
       
   251   | o  1: B
       
   252   |/
       
   253   o  0: A
       
   254   
       
   255 Slightly more complex merge case (mentioned in https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-November/091074.html):
       
   256 
       
   257   $ rebasewithdag -b A3+B3 -d Z <<'EOF'
       
   258   > Z     C1    A3     B3
       
   259   > |    /     / \    / \
       
   260   > M3 C0     A1  A2 B1  B2
       
   261   > | /       |   |  |   |
       
   262   > M2        M1  C1 C1  M3
       
   263   > |
       
   264   > M1
       
   265   > |
       
   266   > M0
       
   267   > EOF
       
   268   rebasing 4:8817fae53c94 "C0" (C0)
       
   269   rebasing 6:06ca5dfe3b5b "B2" (B2)
       
   270   rebasing 7:73508237b032 "C1" (C1)
       
   271   rebasing 9:fdb955e2faed "A2" (A2)
       
   272   rebasing 11:4e449bd1a643 "A3" (A3)
       
   273   rebasing 10:0a33b0519128 "B1" (B1)
       
   274   rebasing 12:209327807c3a "B3" (B3 tip)
       
   275   o    12: B3
       
   276   |\
       
   277   | o  11: B1
       
   278   | |
       
   279   | | o    10: A3
       
   280   | | |\
       
   281   | +---o  9: A2
       
   282   | | |
       
   283   | o |  8: C1
       
   284   | | |
       
   285   o | |  7: B2
       
   286   | | |
       
   287   | o |  6: C0
       
   288   |/ /
       
   289   o |  5: Z
       
   290   | |
       
   291   o |  4: M3
       
   292   | |
       
   293   o |  3: M2
       
   294   | |
       
   295   | o  2: A1
       
   296   |/
       
   297   o  1: M1
       
   298   |
       
   299   o  0: M0
       
   300   
       
   301 Disconnected graph:
       
   302 
       
   303   $ rebasewithdag -b B -d Z <<'EOS'
       
   304   >   B
       
   305   >   |
       
   306   > Z A
       
   307   > EOS
       
   308   nothing to rebase from 112478962961 to 48b9aae0607f
       
   309   [1]
       
   310 
       
   311 Multiple roots. Roots are ancestors of dest:
       
   312 
       
   313   $ rebasewithdag -b B+D -d Z <<'EOF'
       
   314   > D Z B
       
   315   >  \|\|
       
   316   >   C A
       
   317   > EOF
       
   318   rebasing 2:112478962961 "B" (B)
       
   319   rebasing 3:b70f76719894 "D" (D)
       
   320   o  4: D
       
   321   |
       
   322   | o  3: B
       
   323   |/
       
   324   o    2: Z
       
   325   |\
       
   326   | o  1: C
       
   327   |
       
   328   o  0: A
       
   329   
       
   330 Multiple roots. One root is not an ancestor of dest:
       
   331 
       
   332   $ rebasewithdag -b B+D -d Z <<'EOF'
       
   333   > Z B D
       
   334   >  \|\|
       
   335   >   A C
       
   336   > EOF
       
   337   nothing to rebase from f675d5a1c6a4+b70f76719894 to 262e37e34f63
       
   338   [1]
       
   339 
       
   340 Multiple roots. One root is not an ancestor of dest. Select using a merge:
       
   341 
       
   342   $ rebasewithdag -b E -d Z <<'EOF'
       
   343   >   E
       
   344   >   |\
       
   345   > Z B D
       
   346   >  \|\|
       
   347   >   A C
       
   348   > EOF
       
   349   rebasing 2:f675d5a1c6a4 "B" (B)
       
   350   rebasing 5:f68696fe6af8 "E" (E tip)
       
   351   o    5: E
       
   352   |\
       
   353   | o    4: B
       
   354   | |\
       
   355   | | o  3: Z
       
   356   | | |
       
   357   o | |  2: D
       
   358   |/ /
       
   359   o /  1: C
       
   360    /
       
   361   o  0: A
       
   362   
       
   363 Multiple roots. Two children share two parents while dest has only one parent:
       
   364 
       
   365   $ rebasewithdag -b B+D -d Z <<'EOF'
       
   366   > Z B D
       
   367   >  \|\|\
       
   368   >   A C A
       
   369   > EOF
       
   370   rebasing 2:f675d5a1c6a4 "B" (B)
       
   371   rebasing 3:c2a779e13b56 "D" (D)
       
   372   o    4: D
       
   373   |\
       
   374   +---o  3: B
       
   375   | |/
       
   376   | o  2: Z
       
   377   | |
       
   378   o |  1: C
       
   379    /
       
   380   o  0: A
       
   381   
       
   382 Rebasing using a single transaction
       
   383 
       
   384   $ hg init singletr && cd singletr
       
   385   $ cat >> .hg/hgrc <<EOF
       
   386   > [rebase]
       
   387   > singletransaction=True
       
   388   > EOF
       
   389   $ hg debugdrawdag <<'EOF'
       
   390   >   Z
       
   391   >   |
       
   392   >   | D
       
   393   >   | |
       
   394   >   | C
       
   395   >   | |
       
   396   >   Y B
       
   397   >   |/
       
   398   >   A
       
   399   > EOF
       
   400 - We should only see two status stored messages. One from the start, one from
       
   401 - the end.
       
   402   $ hg rebase --debug -b D -d Z | grep 'status stored'
       
   403   rebase status stored
       
   404   rebase status stored
       
   405   $ hg tglog
       
   406   o  5: D
       
   407   |
       
   408   o  4: C
       
   409   |
       
   410   o  3: B
       
   411   |
       
   412   o  2: Z
       
   413   |
       
   414   o  1: Y
       
   415   |
       
   416   o  0: A
       
   417   
       
   418   $ cd ..