tests/test-evolve-topic.t
branchmercurial-3.6
changeset 1798 acfc610ec304
parent 1797 4de90774eade
parent 1761 e2585c6cdbdc
child 1799 b1809340478b
child 1819 642f86363883
equal deleted inserted replaced
1797:4de90774eade 1798:acfc610ec304
     1 
       
     2 Check we can find the topic extensions
       
     3 
       
     4   $ [ -z "$HGTEST_TOPICROOT" ] && echo 'skipped: $HGTEST_TOPICROOT not set' >&2 && exit 80
       
     5   [1]
       
     6   $ [ ! -e $HGTEST_TOPICROOT/hgext3rd/topic/__init__.py ] && echo 'skipped: no topic repo found at $HGTEST_TOPICROOT' >&2 && exit 80
       
     7   [1]
       
     8   $ cat >> $HGRCPATH <<EOF
       
     9   > [defaults]
       
    10   > amend=-d "0 0"
       
    11   > fold=-d "0 0"
       
    12   > [phases]
       
    13   > publish = False
       
    14   > [ui]
       
    15   > logtemplate = {rev} - \{{get(namespaces, "topics")}} {node|short} {desc} ({phase})\n
       
    16   > [diff]
       
    17   > git = 1
       
    18   > unified = 0
       
    19   > [extensions]
       
    20   > rebase = 
       
    21   > topic = $HGTEST_TOPICROOT/hgext3rd/topic/
       
    22   > EOF
       
    23   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
       
    24 
       
    25   $ mkcommit() {
       
    26   >    echo "$1" > "$1"
       
    27   >    hg add "$1"
       
    28   >    hg ci -m "add $1"
       
    29   > }
       
    30 
       
    31 Create a simple setup
       
    32 
       
    33   $ hg init repoa
       
    34   $ cd repoa
       
    35   $ mkcommit aaa
       
    36   $ mkcommit bbb
       
    37   $ hg topic foo
       
    38   $ mkcommit ccc
       
    39   $ mkcommit ddd
       
    40   $ mkcommit eee
       
    41   $ mkcommit fff
       
    42   $ hg topic bar
       
    43   $ mkcommit ggg
       
    44   $ mkcommit hhh
       
    45   $ mkcommit iii
       
    46   $ mkcommit jjj
       
    47 
       
    48   $ hg log -G
       
    49   @  9 - {bar} 1d964213b023 add jjj (draft)
       
    50   |
       
    51   o  8 - {bar} fcab990f3261 add iii (draft)
       
    52   |
       
    53   o  7 - {bar} b0c2554835ac add hhh (draft)
       
    54   |
       
    55   o  6 - {bar} c748293f1c1a add ggg (draft)
       
    56   |
       
    57   o  5 - {foo} 6a6b7365c751 add fff (draft)
       
    58   |
       
    59   o  4 - {foo} 3969ab847d9c add eee (draft)
       
    60   |
       
    61   o  3 - {foo} 4e3a154f38c7 add ddd (draft)
       
    62   |
       
    63   o  2 - {foo} cced9bac76e3 add ccc (draft)
       
    64   |
       
    65   o  1 - {} a4dbed0837ea add bbb (draft)
       
    66   |
       
    67   o  0 - {} 199cc73e9a0b add aaa (draft)
       
    68   
       
    69 
       
    70 Test that evolve --all evolve the current topic
       
    71 -----------------------------------------------
       
    72 
       
    73 make a mess
       
    74 
       
    75   $ hg up foo
       
    76   switching to topic foo
       
    77   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
       
    78   $ hg topic -l 
       
    79   ### topic: foo (?)
       
    80   ### branch: default (?)
       
    81   t4@ add fff (current)
       
    82   t3: add eee
       
    83   t2: add ddd
       
    84   t1: add ccc
       
    85     ^ add bbb
       
    86   $ hg up 'desc(ddd)'
       
    87   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
    88   $ echo ddd >> ddd
       
    89   $ hg amend
       
    90   6 new unstable changesets
       
    91   $ hg up 'desc(fff)'
       
    92   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    93   $ echo fff >> fff
       
    94   $ hg amend
       
    95 
       
    96   $ hg log -G
       
    97   @  13 - {foo} e104f49bab28 add fff (draft)
       
    98   |
       
    99   | o  11 - {foo} d9cacd156ffc add ddd (draft)
       
   100   | |
       
   101   | | o  9 - {bar} 1d964213b023 add jjj (draft)
       
   102   | | |
       
   103   | | o  8 - {bar} fcab990f3261 add iii (draft)
       
   104   | | |
       
   105   | | o  7 - {bar} b0c2554835ac add hhh (draft)
       
   106   | | |
       
   107   | | o  6 - {bar} c748293f1c1a add ggg (draft)
       
   108   | | |
       
   109   +---x  5 - {foo} 6a6b7365c751 add fff (draft)
       
   110   | |
       
   111   o |  4 - {foo} 3969ab847d9c add eee (draft)
       
   112   | |
       
   113   x |  3 - {foo} 4e3a154f38c7 add ddd (draft)
       
   114   |/
       
   115   o  2 - {foo} cced9bac76e3 add ccc (draft)
       
   116   |
       
   117   o  1 - {} a4dbed0837ea add bbb (draft)
       
   118   |
       
   119   o  0 - {} 199cc73e9a0b add aaa (draft)
       
   120   
       
   121 
       
   122 Run evolve --all
       
   123 
       
   124   $ hg evolve --all
       
   125   move:[4] add eee
       
   126   atop:[11] add ddd
       
   127   move:[13] add fff
       
   128   atop:[14] add eee
       
   129   working directory is now at 070c5573d8f9
       
   130   $ hg log -G
       
   131   @  15 - {foo} 070c5573d8f9 add fff (draft)
       
   132   |
       
   133   o  14 - {foo} 42b49017ff90 add eee (draft)
       
   134   |
       
   135   o  11 - {foo} d9cacd156ffc add ddd (draft)
       
   136   |
       
   137   | o  9 - {bar} 1d964213b023 add jjj (draft)
       
   138   | |
       
   139   | o  8 - {bar} fcab990f3261 add iii (draft)
       
   140   | |
       
   141   | o  7 - {bar} b0c2554835ac add hhh (draft)
       
   142   | |
       
   143   | o  6 - {bar} c748293f1c1a add ggg (draft)
       
   144   | |
       
   145   | x  5 - {foo} 6a6b7365c751 add fff (draft)
       
   146   | |
       
   147   | x  4 - {foo} 3969ab847d9c add eee (draft)
       
   148   | |
       
   149   | x  3 - {foo} 4e3a154f38c7 add ddd (draft)
       
   150   |/
       
   151   o  2 - {foo} cced9bac76e3 add ccc (draft)
       
   152   |
       
   153   o  1 - {} a4dbed0837ea add bbb (draft)
       
   154   |
       
   155   o  0 - {} 199cc73e9a0b add aaa (draft)
       
   156   
       
   157 
       
   158 Test that evolve does not loose topic information
       
   159 -------------------------------------------------
       
   160 
       
   161   $ hg evolve --rev 'topic(bar)'
       
   162   move:[6] add ggg
       
   163   atop:[15] add fff
       
   164   move:[7] add hhh
       
   165   atop:[16] add ggg
       
   166   move:[8] add iii
       
   167   atop:[17] add hhh
       
   168   move:[9] add jjj
       
   169   atop:[18] add iii
       
   170   working directory is now at 9bf430c106b7
       
   171   $ hg log -G
       
   172   @  19 - {bar} 9bf430c106b7 add jjj (draft)
       
   173   |
       
   174   o  18 - {bar} d2dc89c57700 add iii (draft)
       
   175   |
       
   176   o  17 - {bar} 20bc4d02aa62 add hhh (draft)
       
   177   |
       
   178   o  16 - {bar} 16d6f664b17c add ggg (draft)
       
   179   |
       
   180   o  15 - {foo} 070c5573d8f9 add fff (draft)
       
   181   |
       
   182   o  14 - {foo} 42b49017ff90 add eee (draft)
       
   183   |
       
   184   o  11 - {foo} d9cacd156ffc add ddd (draft)
       
   185   |
       
   186   o  2 - {foo} cced9bac76e3 add ccc (draft)
       
   187   |
       
   188   o  1 - {} a4dbed0837ea add bbb (draft)
       
   189   |
       
   190   o  0 - {} 199cc73e9a0b add aaa (draft)
       
   191   
       
   192 
       
   193 Tests next and prev behavior
       
   194 ============================
       
   195 
       
   196 Basic move are restricted to the current topic
       
   197 
       
   198   $ hg up foo
       
   199   switching to topic foo
       
   200   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
       
   201   $ hg prev
       
   202   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   203   [14] add eee
       
   204   $ hg next
       
   205   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   206   [15] add fff
       
   207   $ hg next
       
   208   no children on topic "foo"
       
   209   do you want --no-topic
       
   210   [1]
       
   211   $ hg next --no-topic
       
   212   switching to topic bar
       
   213   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   214   [16] add ggg
       
   215   $ hg prev
       
   216   no parent in topic "bar"
       
   217   (do you want --no-topic)
       
   218   $ hg prev --no-topic
       
   219   switching to topic foo
       
   220   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   221   [15] add fff