tests/test-fold.t
changeset 2767 ab80ef8d0cfa
child 2768 85e5a56db776
equal deleted inserted replaced
2766:83ad13719e26 2767:ab80ef8d0cfa
       
     1   $ . $TESTDIR/testlib/common.sh
       
     2 
       
     3 setup
       
     4 
       
     5   $ cat >> $HGRCPATH <<EOF
       
     6   > [defaults]
       
     7   > fold=-d "0 0"
       
     8   > [extensions]
       
     9   > evolve=
       
    10   > [ui]
       
    11   > logtemplate = '{rev} - {node|short} {desc|firstline} [{author}] ({phase})\n'
       
    12   > EOF
       
    13 
       
    14   $ hg init fold-tests
       
    15   $ cd fold-tests/
       
    16   $ hg debugbuilddag .+3:branchpoint+4*branchpoint+2
       
    17   $ hg up 'desc("r7")'
       
    18   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    19   $ hg log -G
       
    20   o  10 - a8407f9a3dc1 r10 [debugbuilddag] (draft)
       
    21   |
       
    22   o  9 - 529dfc5bb875 r9 [debugbuilddag] (draft)
       
    23   |
       
    24   o  8 - abf57d94268b r8 [debugbuilddag] (draft)
       
    25   |
       
    26   | @  7 - 4de32a90b66c r7 [debugbuilddag] (draft)
       
    27   | |
       
    28   | o  6 - f69452c5b1af r6 [debugbuilddag] (draft)
       
    29   | |
       
    30   | o  5 - c8d03c1b5e94 r5 [debugbuilddag] (draft)
       
    31   | |
       
    32   | o  4 - bebd167eb94d r4 [debugbuilddag] (draft)
       
    33   |/
       
    34   o  3 - 2dc09a01254d r3 [debugbuilddag] (draft)
       
    35   |
       
    36   o  2 - 01241442b3c2 r2 [debugbuilddag] (draft)
       
    37   |
       
    38   o  1 - 66f7d451a68b r1 [debugbuilddag] (draft)
       
    39   |
       
    40   o  0 - 1ea73414a91b r0 [debugbuilddag] (draft)
       
    41   
       
    42 
       
    43 Test various error case
       
    44 
       
    45   $ hg fold
       
    46   abort: no revisions specified
       
    47   [255]
       
    48   $ hg fold --from
       
    49   abort: no revisions specified
       
    50   [255]
       
    51   $ hg fold .
       
    52   abort: must specify either --from or --exact
       
    53   [255]
       
    54   $ hg fold --from . --exact
       
    55   abort: cannot use both --from and --exact
       
    56   [255]
       
    57   $ hg fold --from .
       
    58   single revision specified, nothing to fold
       
    59   [1]
       
    60   $ hg fold '0::(7+10)' --exact
       
    61   abort: cannot fold non-linear revisions (multiple heads given)
       
    62   [255]
       
    63   $ hg fold -r 4 -r 6 --exact
       
    64   abort: cannot fold non-linear revisions (multiple roots given)
       
    65   [255]
       
    66   $ hg fold --from 10 1
       
    67   abort: cannot fold non-linear revisions
       
    68   (given revisions are unrelated to parent of working directory)
       
    69   [255]
       
    70   $ hg fold --exact -r "4 and not 4"
       
    71   abort: specified revisions evaluate to an empty set
       
    72   (use different revision arguments)
       
    73   [255]
       
    74   $ hg phase --public 0
       
    75   $ hg fold --from -r 0
       
    76   abort: cannot fold public revisions
       
    77   [255]
       
    78 
       
    79 Test actual folding
       
    80 
       
    81   $ hg fold --from -r 'desc("r5")'
       
    82   3 changesets folded
       
    83   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    84 
       
    85 (test inherited from test-evolve.t)
       
    86 
       
    87   $ hg fold --from 6 # want to run hg fold 6
       
    88   abort: hidden revision '6'!
       
    89   (use --hidden to access hidden revisions; successor: 198b5c405d01)
       
    90   [255]
       
    91 
       
    92   $ hg log -G
       
    93   @  11 - 198b5c405d01 r5 [debugbuilddag] (draft)
       
    94   |
       
    95   | o  10 - a8407f9a3dc1 r10 [debugbuilddag] (draft)
       
    96   | |
       
    97   | o  9 - 529dfc5bb875 r9 [debugbuilddag] (draft)
       
    98   | |
       
    99   | o  8 - abf57d94268b r8 [debugbuilddag] (draft)
       
   100   | |
       
   101   o |  4 - bebd167eb94d r4 [debugbuilddag] (draft)
       
   102   |/
       
   103   o  3 - 2dc09a01254d r3 [debugbuilddag] (draft)
       
   104   |
       
   105   o  2 - 01241442b3c2 r2 [debugbuilddag] (draft)
       
   106   |
       
   107   o  1 - 66f7d451a68b r1 [debugbuilddag] (draft)
       
   108   |
       
   109   o  0 - 1ea73414a91b r0 [debugbuilddag] (public)
       
   110   
       
   111 
       
   112 test fold --exact
       
   113 
       
   114   $ hg fold --exact 'desc("r8") + desc("r10")'
       
   115   abort: cannot fold non-linear revisions (multiple roots given)
       
   116   [255]
       
   117   $ hg fold --exact 'desc("r8")::desc("r10")'
       
   118   3 changesets folded
       
   119   $ hg log -G
       
   120   o  12 - b568edbee6e0 r8 [debugbuilddag] (draft)
       
   121   |
       
   122   | @  11 - 198b5c405d01 r5 [debugbuilddag] (draft)
       
   123   | |
       
   124   | o  4 - bebd167eb94d r4 [debugbuilddag] (draft)
       
   125   |/
       
   126   o  3 - 2dc09a01254d r3 [debugbuilddag] (draft)
       
   127   |
       
   128   o  2 - 01241442b3c2 r2 [debugbuilddag] (draft)
       
   129   |
       
   130   o  1 - 66f7d451a68b r1 [debugbuilddag] (draft)
       
   131   |
       
   132   o  0 - 1ea73414a91b r0 [debugbuilddag] (public)
       
   133   
       
   134 
       
   135 Test allow unstable
       
   136 
       
   137   $ echo a > a
       
   138   $ hg add a
       
   139   $ hg commit '-m r11'
       
   140   $ hg up '.^'
       
   141   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   142   $ hg log -G
       
   143   o  13 - 14d0e0da8e91 r11 [test] (draft)
       
   144   |
       
   145   | o  12 - b568edbee6e0 r8 [debugbuilddag] (draft)
       
   146   | |
       
   147   @ |  11 - 198b5c405d01 r5 [debugbuilddag] (draft)
       
   148   | |
       
   149   o |  4 - bebd167eb94d r4 [debugbuilddag] (draft)
       
   150   |/
       
   151   o  3 - 2dc09a01254d r3 [debugbuilddag] (draft)
       
   152   |
       
   153   o  2 - 01241442b3c2 r2 [debugbuilddag] (draft)
       
   154   |
       
   155   o  1 - 66f7d451a68b r1 [debugbuilddag] (draft)
       
   156   |
       
   157   o  0 - 1ea73414a91b r0 [debugbuilddag] (public)
       
   158   
       
   159 
       
   160   $ cat << EOF >> .hg/hgrc
       
   161   > [experimental]
       
   162   > evolution = createmarkers, allnewcommands
       
   163   > EOF
       
   164   $ hg fold --from 'desc("r4")'
       
   165   abort: cannot fold chain not ending with a head or with branching
       
   166   (new unstable changesets are not allowed)
       
   167   [255]
       
   168   $ hg fold --from 'desc("r3")::desc("r11")'
       
   169   abort: cannot fold chain not ending with a head or with branching
       
   170   (new unstable changesets are not allowed)
       
   171   [255]
       
   172 
       
   173 test --user variant
       
   174 
       
   175   $ cat << EOF >> .hg/hgrc
       
   176   > [experimental]
       
   177   > evolution = createmarkers, allnewcommands
       
   178   > EOF
       
   179   $ cat << EOF >> .hg/hgrc
       
   180   > [experimental]
       
   181   > evolution = all
       
   182   > EOF
       
   183 
       
   184   $ hg fold --exact 'desc("r5") + desc("r11")' --user 'Victor Rataxes <victor@rhino.savannah>'
       
   185   2 changesets folded
       
   186   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   187   $ hg log -G
       
   188   @  14 - 29b470a33594 r5 [Victor Rataxes <victor@rhino.savannah>] (draft)
       
   189   |
       
   190   | o  12 - b568edbee6e0 r8 [debugbuilddag] (draft)
       
   191   | |
       
   192   o |  4 - bebd167eb94d r4 [debugbuilddag] (draft)
       
   193   |/
       
   194   o  3 - 2dc09a01254d r3 [debugbuilddag] (draft)
       
   195   |
       
   196   o  2 - 01241442b3c2 r2 [debugbuilddag] (draft)
       
   197   |
       
   198   o  1 - 66f7d451a68b r1 [debugbuilddag] (draft)
       
   199   |
       
   200   o  0 - 1ea73414a91b r0 [debugbuilddag] (public)
       
   201   
       
   202 
       
   203   $ cd ..
       
   204