tests/test-topicmode.t
changeset 3029 402bfc232ce9
parent 3028 c2d1f49ac7e2
child 3030 581a6b9d2c8c
equal deleted inserted replaced
3028:c2d1f49ac7e2 3029:402bfc232ce9
     1   $ . "$TESTDIR/testlib/topic_setup.sh"
       
     2 
       
     3 Testing the new config knob to forbid untopiced commit
       
     4 ======================================================
       
     5 
       
     6   $ hg init $TESTTMP/untopic-commit
       
     7   $ cd $TESTTMP/untopic-commit
       
     8   $ cat <<EOF >> .hg/hgrc
       
     9   > [phases]
       
    10   > publish=false
       
    11   > EOF
       
    12   $ cat <<EOF >> $HGRCPATH
       
    13   > [experimental]
       
    14   > topic-mode = enforce
       
    15   > EOF
       
    16   $ touch a b c d
       
    17   $ hg add a
       
    18   $ hg ci -m "Added a"
       
    19   abort: no active topic
       
    20   (see 'hg help -e topic.topic-mode' for details)
       
    21   [255]
       
    22 
       
    23 (same test, checking we abort before the editor)
       
    24 
       
    25   $ EDITOR=cat hg ci -m "Added a" --edit
       
    26   abort: no active topic
       
    27   (see 'hg help -e topic.topic-mode' for details)
       
    28   [255]
       
    29   $ hg ci -m "added a" --config experimental.topic-mode=off
       
    30   $ hg log
       
    31   changeset:   0:a154386e50d1
       
    32   tag:         tip
       
    33   user:        test
       
    34   date:        Thu Jan 01 00:00:00 1970 +0000
       
    35   summary:     added a
       
    36   
       
    37 
       
    38 Testing the new config knob to warn about untopiced commit
       
    39 ==========================================================
       
    40 
       
    41   $ hg init $TESTTMP/untopic-warn-commit
       
    42   $ cd $TESTTMP/untopic-warn-commit
       
    43   $ cat <<EOF >> .hg/hgrc
       
    44   > [phases]
       
    45   > publish=false
       
    46   > EOF
       
    47   $ cat <<EOF >> $HGRCPATH
       
    48   > [experimental]
       
    49   > topic-mode = warning
       
    50   > EOF
       
    51   $ touch a b c d
       
    52   $ hg add a
       
    53   $ hg ci -m "Added a"
       
    54   warning: new draft commit without topic
       
    55   (see 'hg help -e topic.topic-mode' for details) (no-eol)
       
    56 
       
    57 (same test, checking we abort before the editor)
       
    58 
       
    59   $ EDITOR=cat hg ci --amend -m "Added a" --edit
       
    60   warning: new draft commit without topic
       
    61   (see 'hg help -e topic.topic-mode' for details) (no-eol)
       
    62   $ hg ci --amend -m "added a'" --config experimental.topic-mode=off
       
    63   $ hg log
       
    64   changeset:   2:2e862d8b5eff
       
    65   tag:         tip
       
    66   parent:      -1:000000000000
       
    67   user:        test
       
    68   date:        Thu Jan 01 00:00:00 1970 +0000
       
    69   summary:     added a'
       
    70   
       
    71 
       
    72 Testing the new config knob to warn about untopiced merge commit
       
    73 ================================================================
       
    74 
       
    75   $ hg init $TESTTMP/test-untopic-merge-commit
       
    76   $ cd $TESTTMP/test-untopic-merge-commit
       
    77   $ cat <<EOF >> .hg/hgrc
       
    78   > [phases]
       
    79   > publish=false
       
    80   > EOF
       
    81   $ cat <<EOF >> $HGRCPATH
       
    82   > [experimental]
       
    83   > topic-mode = enforce
       
    84   > EOF
       
    85   $ touch ROOT
       
    86   $ hg commit -A -m "ROOT" --config experimental.topic-mode=off
       
    87   adding ROOT
       
    88   $ touch a
       
    89   $ hg add a
       
    90   $ hg topic mytopic
       
    91   marked working directory as topic: mytopic
       
    92   $ hg ci -m "Added a"
       
    93   active topic 'mytopic' grew its first changeset
       
    94 
       
    95   $ hg up -r "desc('ROOT')"
       
    96   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
    97   $ touch default
       
    98   $ hg add default
       
    99   $ hg commit -m "default" --config experimental.topic-mode=off
       
   100 
       
   101   $ hg merge mytopic
       
   102   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   103   (branch merge, don't forget to commit)
       
   104   $ hg commit -m "merge mytopic"
       
   105   warning: new draft commit without topic
       
   106   (see 'hg help -e topic.topic-mode' for details) (no-eol)
       
   107 
       
   108   $ hg log -G
       
   109   @    changeset:   3:676a445d1c09
       
   110   |\   tag:         tip
       
   111   | |  parent:      2:a4da109ee59f
       
   112   | |  parent:      1:e5b6c632bd8e
       
   113   | |  user:        test
       
   114   | |  date:        Thu Jan 01 00:00:00 1970 +0000
       
   115   | |  summary:     merge mytopic
       
   116   | |
       
   117   | o  changeset:   2:a4da109ee59f
       
   118   | |  parent:      0:ec1d2790416d
       
   119   | |  user:        test
       
   120   | |  date:        Thu Jan 01 00:00:00 1970 +0000
       
   121   | |  summary:     default
       
   122   | |
       
   123   o |  changeset:   1:e5b6c632bd8e
       
   124   |/   topic:       mytopic
       
   125   |    user:        test
       
   126   |    date:        Thu Jan 01 00:00:00 1970 +0000
       
   127   |    summary:     Added a
       
   128   |
       
   129   o  changeset:   0:ec1d2790416d
       
   130      user:        test
       
   131      date:        Thu Jan 01 00:00:00 1970 +0000
       
   132      summary:     ROOT
       
   133   
       
   134 
       
   135 Testing the config knob to about on untopiced merge commit
       
   136 ================================================================
       
   137 
       
   138   $ hg init $TESTTMP/test-untopic-merge-commit-abort
       
   139   $ cd $TESTTMP/test-untopic-merge-commit-abort
       
   140   $ cat <<EOF >> .hg/hgrc
       
   141   > [phases]
       
   142   > publish=false
       
   143   > EOF
       
   144   $ cat <<EOF >> $HGRCPATH
       
   145   > [experimental]
       
   146   > topic-mode = enforce-all
       
   147   > EOF
       
   148   $ touch ROOT
       
   149   $ hg commit -A -m "ROOT" --config experimental.topic-mode=off
       
   150   adding ROOT
       
   151   $ touch a
       
   152   $ hg add a
       
   153   $ hg topic mytopic
       
   154   marked working directory as topic: mytopic
       
   155   $ hg ci -m "Added a"
       
   156   active topic 'mytopic' grew its first changeset
       
   157 
       
   158   $ hg up -r "desc('ROOT')"
       
   159   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   160   $ touch default
       
   161   $ hg add default
       
   162   $ hg commit -m "default" --config experimental.topic-mode=off
       
   163 
       
   164   $ hg merge mytopic
       
   165   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   166   (branch merge, don't forget to commit)
       
   167   $ hg commit -m "merge mytopic"
       
   168   abort: no active topic
       
   169   (see 'hg help -e topic.topic-mode' for details)
       
   170   [255]
       
   171 
       
   172   $ hg log -G
       
   173   @  changeset:   2:a4da109ee59f
       
   174   |  tag:         tip
       
   175   |  parent:      0:ec1d2790416d
       
   176   |  user:        test
       
   177   |  date:        Thu Jan 01 00:00:00 1970 +0000
       
   178   |  summary:     default
       
   179   |
       
   180   | @  changeset:   1:e5b6c632bd8e
       
   181   |/   topic:       mytopic
       
   182   |    user:        test
       
   183   |    date:        Thu Jan 01 00:00:00 1970 +0000
       
   184   |    summary:     Added a
       
   185   |
       
   186   o  changeset:   0:ec1d2790416d
       
   187      user:        test
       
   188      date:        Thu Jan 01 00:00:00 1970 +0000
       
   189      summary:     ROOT
       
   190   
       
   191 Testing the new config knob to use a random topic for untopic commit
       
   192 ====================================================================
       
   193 
       
   194   $ hg init $TESTTMP/test-untopic-random
       
   195   $ cd $TESTTMP/test-untopic-random
       
   196   $ cat <<EOF >> .hg/hgrc
       
   197   > [phases]
       
   198   > publish=false
       
   199   > EOF
       
   200   $ cat <<EOF >> $HGRCPATH
       
   201   > [experimental]
       
   202   > topic-mode = random
       
   203   > EOF
       
   204 
       
   205   $ touch ROOT
       
   206   $ hg commit -A -m "ROOT" --config experimental.topic-mode=off
       
   207   adding ROOT
       
   208 
       
   209   $ touch A
       
   210   $ hg add A
       
   211   $ hg commit -m "Add A" --config devel.randomseed=42
       
   212   active topic 'panoramic-antelope' grew its first changeset
       
   213 
       
   214   $ hg up -r "desc(ROOT)"
       
   215   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   216 
       
   217   $ touch B
       
   218   $ hg add B
       
   219   $ hg commit -m "Add B" --config devel.randomseed=128
       
   220   active topic 'various-dove' grew its first changeset