tests/test-mq-guards
branchstable
changeset 12795 3cb0559e44d0
parent 12793 469850088fc1
parent 12794 6bf8d48bec8e
child 12796 bc69ba99e34b
equal deleted inserted replaced
12793:469850088fc1 12795:3cb0559e44d0
     1 #!/bin/sh
       
     2 
       
     3 echo "[extensions]" >> $HGRCPATH
       
     4 echo "mq=" >> $HGRCPATH
       
     5 
       
     6 hg init
       
     7 hg qinit
       
     8 
       
     9 echo x > x
       
    10 hg ci -Ama
       
    11 
       
    12 hg qnew a.patch
       
    13 echo a > a
       
    14 hg add a
       
    15 hg qrefresh
       
    16 
       
    17 hg qnew b.patch
       
    18 echo b > b
       
    19 hg add b
       
    20 hg qrefresh
       
    21 
       
    22 hg qnew c.patch
       
    23 echo c > c
       
    24 hg add c
       
    25 hg qrefresh
       
    26 
       
    27 hg qpop -a
       
    28 
       
    29 echo % should fail
       
    30 hg qguard does-not-exist.patch +bleh
       
    31 
       
    32 echo % should fail
       
    33 hg qguard +fail
       
    34 
       
    35 hg qpush
       
    36 echo % should guard a.patch
       
    37 hg qguard +a
       
    38 echo % should print +a
       
    39 hg qguard
       
    40 hg qpop
       
    41 
       
    42 echo % should fail
       
    43 hg qpush a.patch
       
    44 
       
    45 hg qguard a.patch
       
    46 echo % should push b.patch
       
    47 hg qpush
       
    48 
       
    49 hg qpop
       
    50 echo % test selection of an empty guard
       
    51 hg qselect ""
       
    52 hg qselect a
       
    53 echo % should push a.patch
       
    54 hg qpush
       
    55 
       
    56 hg qguard -- c.patch -a
       
    57 echo % should print -a
       
    58 hg qguard c.patch
       
    59 
       
    60 echo % should skip c.patch
       
    61 hg qpush -a
       
    62 echo % should display b.patch
       
    63 hg qtop
       
    64 
       
    65 hg qguard -n c.patch
       
    66 echo % should push c.patch
       
    67 hg qpush -a
       
    68 
       
    69 hg qpop -a
       
    70 hg qselect -n
       
    71 echo % should push all
       
    72 hg qpush -a
       
    73 
       
    74 hg qpop -a
       
    75 hg qguard a.patch +1
       
    76 hg qguard b.patch +2
       
    77 hg qselect 1
       
    78 echo % should push a.patch, not b.patch
       
    79 hg qpush
       
    80 hg qpush
       
    81 hg qpop -a
       
    82 
       
    83 hg qselect 2
       
    84 echo % should push b.patch
       
    85 hg qpush
       
    86 hg qpush -a
       
    87 # Used to be an issue with holes in the patch sequence
       
    88 # So, put one hole on the base and ask for topmost patch.
       
    89 hg qtop
       
    90 hg qpop -a
       
    91 
       
    92 hg qselect 1 2
       
    93 echo % should push a.patch, b.patch
       
    94 hg qpush
       
    95 hg qpush
       
    96 hg qpop -a
       
    97 
       
    98 hg qguard -- a.patch +1 +2 -3
       
    99 hg qselect 1 2 3
       
   100 echo % list patches and guards
       
   101 hg qguard -l
       
   102 echo % list patches and guards with color
       
   103 hg --config extensions.color= qguard --config color.mode=ansi \
       
   104     -l --color=always
       
   105 echo % list series
       
   106 hg qseries -v
       
   107 echo % list guards
       
   108 hg qselect
       
   109 echo % should push b.patch
       
   110 hg qpush
       
   111 
       
   112 hg qpush -a
       
   113 hg qselect -n --reapply
       
   114 echo % guards in series file: +1 +2 -3
       
   115 hg qselect -s
       
   116 echo % should show c.patch
       
   117 hg qapplied
       
   118 
       
   119 hg qrename a.patch new.patch
       
   120 echo % should show :
       
   121 echo % new.patch: +1 +2 -3
       
   122 echo % b.patch: +2
       
   123 echo % c.patch: unguarded
       
   124 hg qguard -l
       
   125 
       
   126 hg qnew d.patch
       
   127 hg qpop
       
   128 echo % should show new.patch and b.patch as Guarded, c.patch as Applied
       
   129 echo % and d.patch as Unapplied
       
   130 hg qseries -v
       
   131 echo % qseries again, but with color
       
   132 hg --config extensions.color= qseries -v --color=always
       
   133 
       
   134 hg qguard d.patch +2
       
   135 echo % new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded.
       
   136 hg qseries -v
       
   137 
       
   138 qappunappv()
       
   139 {
       
   140     for command in qapplied "qapplied -v" qunapplied "qunapplied -v"; do
       
   141         echo % hg $command
       
   142         hg $command
       
   143     done
       
   144 }
       
   145 
       
   146 hg qpop -a
       
   147 hg qguard -l
       
   148 qappunappv
       
   149 hg qselect 1
       
   150 qappunappv
       
   151 hg qpush -a
       
   152 qappunappv
       
   153 hg qselect 2
       
   154 qappunappv
       
   155 
       
   156 for patch in `hg qseries`; do
       
   157     echo % hg qapplied $patch
       
   158     hg qapplied $patch
       
   159     echo % hg qunapplied $patch
       
   160     hg qunapplied $patch
       
   161 done
       
   162 
       
   163 echo % hg qseries -m: only b.patch should be shown
       
   164 echo the guards file was not ignored in the past
       
   165 hg qdelete -k b.patch
       
   166 hg qseries -m
       
   167 echo % hg qseries -m with color
       
   168 hg --config extensions.color= qseries -m --color=always