tests/test-topic-rebase.t
branchmercurial-3.9
changeset 2801 49494d0155b7
parent 2800 13c4d518327a
parent 2702 167567795f6c
child 2802 41c9a4df628e
child 2811 35d053d7bd87
equal deleted inserted replaced
2800:13c4d518327a 2801:49494d0155b7
     1 test of the rebase command
       
     2 --------------------------
       
     3 
       
     4   $ cat >> $HGRCPATH <<EOF
       
     5   > [defaults]
       
     6   > amend=-d "0 0"
       
     7   > fold=-d "0 0"
       
     8   > split=-d "0 0"
       
     9   > amend=-d "0 0"
       
    10   > [web]
       
    11   > push_ssl = false
       
    12   > allow_push = *
       
    13   > [phases]
       
    14   > publish = False
       
    15   > [diff]
       
    16   > git = 1
       
    17   > unified = 0
       
    18   > [ui]
       
    19   > interactive = true
       
    20   > [extensions]
       
    21   > rebase=
       
    22   > EOF
       
    23   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
       
    24   $ echo "topic=$(echo $(dirname $TESTDIR))/hgext3rd/topic/" >> $HGRCPATH
       
    25   $ mkcommit() {
       
    26   >    echo "$1" > "$1"
       
    27   >    hg add "$1"
       
    28   >    hg ci -m "add $1" $2 $3
       
    29   > }
       
    30   $ logtopic() {
       
    31   >    hg log -G -T "{rev}:{node}\ntopics: {topics}" 
       
    32   > }
       
    33 
       
    34 Check that rebase keep the topic in the simple case (1 changeset, no merge conflict)
       
    35 ------------------------------------------------------------------------------------
       
    36 
       
    37   $ hg init testrebase
       
    38   $ cd testrebase
       
    39   $ mkcommit ROOT
       
    40 
       
    41 Work on myfeature
       
    42   $ hg topic myfeature
       
    43   $ mkcommit feature1
       
    44   $ hg stack
       
    45   ### topic: myfeature
       
    46   ### branch: default
       
    47   t1@ add feature1 (current)
       
    48   t0^ add ROOT (base)
       
    49   $ logtopic
       
    50   @  1:39e7a938055e87615edf675c24a10997ff05bb06
       
    51   |  topics: myfeature
       
    52   o  0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7
       
    53      topics:
       
    54 
       
    55 Create another commit on default
       
    56   $ hg update --rev default
       
    57   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
    58   $ mkcommit default
       
    59   $ logtopic
       
    60   @  2:be7622a7a0f43ba713e152f56441275f8e8711ef
       
    61   |  topics:
       
    62   | o  1:39e7a938055e87615edf675c24a10997ff05bb06
       
    63   |/   topics: myfeature
       
    64   o  0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7
       
    65      topics:
       
    66 
       
    67 Rebase the commit
       
    68   $ hg update --rev 1
       
    69   switching to topic myfeature
       
    70   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
    71   $ hg rebase
       
    72   rebasing 1:39e7a938055e "add feature1"
       
    73   switching to topic myfeature
       
    74   $ hg stack
       
    75   ### topic: myfeature
       
    76   ### branch: default
       
    77   t1@ add feature1 (current)
       
    78   t0^ add default (base)
       
    79   $ logtopic
       
    80   @  3:fc6593661cf3256ba165cbccd6019ead17cc3726
       
    81   |  topics: myfeature
       
    82   o  2:be7622a7a0f43ba713e152f56441275f8e8711ef
       
    83   |  topics:
       
    84   o  0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7
       
    85      topics:
       
    86   $ hg up 3
       
    87   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    88   $ hg stack
       
    89   ### topic: myfeature
       
    90   ### branch: default
       
    91   t1@ add feature1 (current)
       
    92   t0^ add default (base)
       
    93 
       
    94 Check that rebase keep the topic in case of merge conflict
       
    95 ----------------------------------------------------------
       
    96 
       
    97 Create a common base
       
    98   $ hg topic --clear
       
    99   $ echo "A" > file
       
   100   $ hg commit -A -m "default2" file
       
   101   created new head
       
   102 
       
   103 Update the common file in a topic
       
   104   $ hg topic myotherfeature
       
   105   $ echo "B" >> file
       
   106   $ hg commit -m "myotherfeature1"
       
   107 
       
   108 Update the common file in default
       
   109   $ hg update --rev default
       
   110   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   111   $ echo "A2" > file
       
   112   $ hg commit -m "default3"
       
   113 
       
   114 Rebase the topic
       
   115   $ hg update --rev 5
       
   116   switching to topic myotherfeature
       
   117   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   118   $ hg rebase
       
   119   rebasing 5:81f854012ec5 "myotherfeature1"
       
   120   merging file
       
   121   warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
       
   122   switching to topic myotherfeature
       
   123   unresolved conflicts (see hg resolve, then hg rebase --continue)
       
   124   [1]
       
   125 
       
   126 Resolve the conflict
       
   127   $ echo A2 > file
       
   128   $ echo B >> file
       
   129   $ hg resolve -m
       
   130   (no more unresolved files)
       
   131   continue: hg rebase --continue
       
   132   $ hg rebase --continue
       
   133   rebasing 5:81f854012ec5 "myotherfeature1"
       
   134 
       
   135 Check the the commit has the right topic
       
   136 
       
   137   $ logtopic
       
   138   @  7:6ccb9ec4913b64f3ad719ff1ba66495a70bf35a4
       
   139   |  topics: myotherfeature
       
   140   o  6:0b124ef641a7a6f4715d962650d3b367e8c800be
       
   141   |  topics:
       
   142   o  4:0cd2e1a45ac4e3f9603a05ccfa6d1c70cd759bc5
       
   143   |  topics:
       
   144   o  3:fc6593661cf3256ba165cbccd6019ead17cc3726
       
   145   |  topics: myfeature
       
   146   o  2:be7622a7a0f43ba713e152f56441275f8e8711ef
       
   147   |  topics:
       
   148   o  0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7
       
   149      topics:
       
   150   $ hg stack
       
   151   ### topic: myotherfeature
       
   152   ### branch: default
       
   153   t1@ myotherfeature1 (current)
       
   154   t0^ default3 (base)
       
   155   $ hg update --rev 7
       
   156   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   157   $ hg stack
       
   158   ### topic: myotherfeature
       
   159   ### branch: default
       
   160   t1@ myotherfeature1 (current)
       
   161   t0^ default3 (base)