tests/test-topicmode.t
changeset 3023 cc740c545776
child 3024 89855920fb0f
equal deleted inserted replaced
3022:255e66783505 3023:cc740c545776
       
     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   (set a current topic or use '--config experimental.topic-mode=off' to commit without a topic)
       
    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   (set a current topic or use '--config experimental.topic-mode=off' to commit without a topic)
       
    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 
       
    56 (same test, checking we abort before the editor)
       
    57 
       
    58   $ EDITOR=cat hg ci --amend -m "Added a" --edit
       
    59   warning: new draft commit without topic
       
    60   $ hg ci --amend -m "added a'" --config experimental.topic-mode=off
       
    61   $ hg log
       
    62   changeset:   2:2e862d8b5eff
       
    63   tag:         tip
       
    64   parent:      -1:000000000000
       
    65   user:        test
       
    66   date:        Thu Jan 01 00:00:00 1970 +0000
       
    67   summary:     added a'
       
    68