tests/test-rebase-scenario-global.t
changeset 12608 16b854cb80f1
parent 11208 2313dc4d9817
child 12640 6cc4b14fb76b
equal deleted inserted replaced
12607:1393a81b3bdc 12608:16b854cb80f1
       
     1   $ cat >> $HGRCPATH <<EOF
       
     2   > [extensions]
       
     3   > graphlog=
       
     4   > rebase=
       
     5   > 
       
     6   > [alias]
       
     7   > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
       
     8   > EOF
       
     9 
       
    10 
       
    11   $ hg init a
       
    12   $ cd a
       
    13 
       
    14   $ echo A > A
       
    15   $ hg ci -Am A
       
    16   adding A
       
    17 
       
    18   $ echo B > B
       
    19   $ hg ci -Am B
       
    20   adding B
       
    21 
       
    22   $ hg up -q -C 0
       
    23 
       
    24   $ echo C > C
       
    25   $ hg ci -Am C
       
    26   adding C
       
    27   created new head
       
    28 
       
    29   $ hg up -q -C 0
       
    30 
       
    31   $ echo D > D
       
    32   $ hg ci -Am D
       
    33   adding D
       
    34   created new head
       
    35 
       
    36   $ hg merge -r 2
       
    37   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    38   (branch merge, don't forget to commit)
       
    39 
       
    40   $ hg ci -m E
       
    41 
       
    42   $ hg up -q -C 3
       
    43 
       
    44   $ echo F > F
       
    45   $ hg ci -Am F
       
    46   adding F
       
    47   created new head
       
    48 
       
    49   $ cd ..
       
    50 
       
    51 
       
    52 Rebasing
       
    53 B onto F - simple rebase:
       
    54 
       
    55   $ hg clone -q -u . a a1
       
    56   $ cd a1
       
    57 
       
    58   $ hg tglog
       
    59   @  5: 'F'
       
    60   |
       
    61   | o  4: 'E'
       
    62   |/|
       
    63   o |  3: 'D'
       
    64   | |
       
    65   | o  2: 'C'
       
    66   |/
       
    67   | o  1: 'B'
       
    68   |/
       
    69   o  0: 'A'
       
    70   
       
    71   $ hg rebase -s 1 -d 5
       
    72   saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
       
    73 
       
    74   $ hg tglog
       
    75   @  5: 'B'
       
    76   |
       
    77   o  4: 'F'
       
    78   |
       
    79   | o  3: 'E'
       
    80   |/|
       
    81   o |  2: 'D'
       
    82   | |
       
    83   | o  1: 'C'
       
    84   |/
       
    85   o  0: 'A'
       
    86   
       
    87   $ cd ..
       
    88 
       
    89 
       
    90 B onto D - intermediate point:
       
    91 
       
    92   $ hg clone -q -u . a a2
       
    93   $ cd a2
       
    94 
       
    95   $ hg rebase -s 1 -d 3
       
    96   saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
       
    97 
       
    98   $ hg tglog
       
    99   @  5: 'B'
       
   100   |
       
   101   | o  4: 'F'
       
   102   |/
       
   103   | o  3: 'E'
       
   104   |/|
       
   105   o |  2: 'D'
       
   106   | |
       
   107   | o  1: 'C'
       
   108   |/
       
   109   o  0: 'A'
       
   110   
       
   111   $ cd ..
       
   112 
       
   113 
       
   114 C onto F - skip of E:
       
   115 
       
   116   $ hg clone -q -u . a a3
       
   117   $ cd a3
       
   118 
       
   119   $ hg rebase -s 2 -d 5
       
   120   saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
       
   121 
       
   122   $ hg tglog
       
   123   @  4: 'C'
       
   124   |
       
   125   o  3: 'F'
       
   126   |
       
   127   o  2: 'D'
       
   128   |
       
   129   | o  1: 'B'
       
   130   |/
       
   131   o  0: 'A'
       
   132   
       
   133   $ cd ..
       
   134 
       
   135 
       
   136 D onto C - rebase of a branching point (skip E):
       
   137 
       
   138   $ hg clone -q -u . a a4
       
   139   $ cd a4
       
   140 
       
   141   $ hg rebase -s 3 -d 2
       
   142   saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
       
   143 
       
   144   $ hg tglog
       
   145   @  4: 'F'
       
   146   |
       
   147   o  3: 'D'
       
   148   |
       
   149   o  2: 'C'
       
   150   |
       
   151   | o  1: 'B'
       
   152   |/
       
   153   o  0: 'A'
       
   154   
       
   155   $ cd ..
       
   156 
       
   157 
       
   158 E onto F - merged revision having a parent in ancestors of target:
       
   159 
       
   160   $ hg clone -q -u . a a5
       
   161   $ cd a5
       
   162 
       
   163   $ hg rebase -s 4 -d 5
       
   164   saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
       
   165 
       
   166   $ hg tglog
       
   167   @    5: 'E'
       
   168   |\
       
   169   | o  4: 'F'
       
   170   | |
       
   171   | o  3: 'D'
       
   172   | |
       
   173   o |  2: 'C'
       
   174   |/
       
   175   | o  1: 'B'
       
   176   |/
       
   177   o  0: 'A'
       
   178   
       
   179   $ cd ..
       
   180 
       
   181 
       
   182 D onto B - E maintains C as parent:
       
   183 
       
   184   $ hg clone -q -u . a a6
       
   185   $ cd a6
       
   186 
       
   187   $ hg rebase -s 3 -d 1
       
   188   saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
       
   189 
       
   190   $ hg tglog
       
   191   @  5: 'F'
       
   192   |
       
   193   | o  4: 'E'
       
   194   |/|
       
   195   o |  3: 'D'
       
   196   | |
       
   197   | o  2: 'C'
       
   198   | |
       
   199   o |  1: 'B'
       
   200   |/
       
   201   o  0: 'A'
       
   202   
       
   203   $ cd ..
       
   204 
       
   205 
       
   206 These will fail (using --source):
       
   207 
       
   208 E onto D - rebase onto an ancestor:
       
   209 
       
   210   $ hg clone -q -u . a a7
       
   211   $ cd a7
       
   212 
       
   213   $ hg rebase -s 4 -d 3
       
   214   abort: source is descendant of destination
       
   215   [255]
       
   216 
       
   217 D onto E - rebase onto a descendant:
       
   218 
       
   219   $ hg rebase -s 3 -d 4
       
   220   abort: source is ancestor of destination
       
   221   [255]
       
   222 
       
   223 E onto B - merge revision with both parents not in ancestors of target:
       
   224 
       
   225   $ hg rebase -s 4 -d 1
       
   226   abort: cannot use revision 4 as base, result would have 3 parents
       
   227   [255]
       
   228 
       
   229 
       
   230 These will abort gracefully (using --base):
       
   231 
       
   232 E onto E - rebase onto same changeset:
       
   233 
       
   234   $ hg rebase -b 4 -d 4
       
   235   nothing to rebase
       
   236   [1]
       
   237 
       
   238 E onto D - rebase onto an ancestor:
       
   239 
       
   240   $ hg rebase -b 4 -d 3
       
   241   nothing to rebase
       
   242   [1]
       
   243 
       
   244 D onto E - rebase onto a descendant:
       
   245 
       
   246   $ hg rebase -b 3 -d 4
       
   247   nothing to rebase
       
   248   [1]
       
   249