tests/test-record
changeset 12074 35c143e85b1b
parent 12073 adfff89e6058
child 12075 f585c9bb85c1
equal deleted inserted replaced
12073:adfff89e6058 12074:35c143e85b1b
     1 #!/bin/sh
       
     2 
       
     3 echo "[ui]" >> $HGRCPATH
       
     4 echo "interactive=true" >> $HGRCPATH
       
     5 echo "[extensions]" >> $HGRCPATH
       
     6 echo "record=" >> $HGRCPATH
       
     7 
       
     8 echo % help
       
     9 
       
    10 hg help record
       
    11 
       
    12 hg init a
       
    13 cd a
       
    14 
       
    15 echo % select no files
       
    16 
       
    17 touch empty-rw
       
    18 hg add empty-rw
       
    19 hg record empty-rw<<EOF
       
    20 n
       
    21 EOF
       
    22 echo; hg tip -p
       
    23 
       
    24 echo % select files but no hunks
       
    25 
       
    26 hg record empty-rw<<EOF
       
    27 y
       
    28 n
       
    29 EOF
       
    30 echo; hg tip -p
       
    31 
       
    32 echo % record empty file
       
    33 
       
    34 hg record -d '0 0' -m empty empty-rw<<EOF
       
    35 y
       
    36 y
       
    37 EOF
       
    38 echo; hg tip -p
       
    39 
       
    40 echo % summary shows we updated to the new cset
       
    41 hg summary
       
    42 echo
       
    43 
       
    44 echo % rename empty file
       
    45 
       
    46 hg mv empty-rw empty-rename
       
    47 hg record -d '1 0' -m rename<<EOF
       
    48 y
       
    49 EOF
       
    50 echo; hg tip -p
       
    51 
       
    52 echo % copy empty file
       
    53 
       
    54 hg cp empty-rename empty-copy
       
    55 hg record -d '2 0' -m copy<<EOF
       
    56 y
       
    57 EOF
       
    58 echo; hg tip -p
       
    59 
       
    60 echo % delete empty file
       
    61 
       
    62 hg rm empty-copy
       
    63 hg record -d '3 0' -m delete<<EOF
       
    64 y
       
    65 EOF
       
    66 echo; hg tip -p
       
    67 
       
    68 echo % add binary file
       
    69 
       
    70 hg bundle --base -2 tip.bundle
       
    71 hg add tip.bundle
       
    72 hg record -d '4 0' -m binary<<EOF
       
    73 y
       
    74 EOF
       
    75 echo; hg tip -p
       
    76 
       
    77 echo % change binary file
       
    78 
       
    79 hg bundle --base -2 tip.bundle
       
    80 hg record -d '5 0' -m binary-change<<EOF
       
    81 y
       
    82 EOF
       
    83 echo; hg tip -p
       
    84 
       
    85 echo % rename and change binary file
       
    86 
       
    87 hg mv tip.bundle top.bundle
       
    88 hg bundle --base -2 top.bundle
       
    89 hg record -d '6 0' -m binary-change-rename<<EOF
       
    90 y
       
    91 EOF
       
    92 echo; hg tip -p
       
    93 
       
    94 echo % add plain file
       
    95 
       
    96 for i in 1 2 3 4 5 6 7 8 9 10; do
       
    97     echo $i >> plain
       
    98 done
       
    99 
       
   100 hg add plain
       
   101 hg record -d '7 0' -m plain plain<<EOF
       
   102 y
       
   103 y
       
   104 EOF
       
   105 echo; hg tip -p
       
   106 
       
   107 echo % modify end of plain file
       
   108 
       
   109 echo 11 >> plain
       
   110 hg record -d '8 0' -m end plain <<EOF
       
   111 y
       
   112 y
       
   113 EOF
       
   114 
       
   115 echo % modify end of plain file, no EOL
       
   116 
       
   117 hg tip --template '{node}' >> plain
       
   118 hg record -d '9 0' -m noeol plain <<EOF
       
   119 y
       
   120 y
       
   121 EOF
       
   122 
       
   123 echo % modify end of plain file, add EOL
       
   124 
       
   125 echo >> plain
       
   126 hg record -d '10 0' -m eol plain <<EOF
       
   127 y
       
   128 y
       
   129 y
       
   130 EOF
       
   131 
       
   132 echo % modify beginning, trim end, record both
       
   133 
       
   134 rm plain
       
   135 for i in 2 2 3 4 5 6 7 8 9 10; do
       
   136   echo $i >> plain
       
   137 done
       
   138 
       
   139 hg record -d '10 0' -m begin-and-end plain <<EOF
       
   140 y
       
   141 y
       
   142 y
       
   143 EOF
       
   144 echo; hg tip -p
       
   145 
       
   146 echo % trim beginning, modify end
       
   147 
       
   148 rm plain
       
   149 for i in 4 5 6 7 8 9 10.new; do
       
   150   echo $i >> plain
       
   151 done
       
   152 
       
   153 echo % record end
       
   154 
       
   155 hg record -d '11 0' -m end-only plain <<EOF
       
   156 y
       
   157 n
       
   158 y
       
   159 EOF
       
   160 echo; hg tip -p
       
   161 
       
   162 echo % record beginning
       
   163 
       
   164 hg record -d '12 0' -m begin-only plain <<EOF
       
   165 y
       
   166 y
       
   167 EOF
       
   168 echo; hg tip -p
       
   169 
       
   170 echo % add to beginning, trim from end
       
   171 
       
   172 rm plain
       
   173 for i in 1 2 3 4 5 6 7 8 9; do
       
   174   echo $i >> plain
       
   175 done
       
   176 
       
   177 echo % record end
       
   178 
       
   179 hg record --traceback -d '13 0' -m end-again plain<<EOF
       
   180 y
       
   181 n
       
   182 y
       
   183 EOF
       
   184 
       
   185 echo % add to beginning, middle, end
       
   186 
       
   187 rm plain
       
   188 for i in 1 2 3 4 5 5.new 5.reallynew 6 7 8 9 10 11; do
       
   189   echo $i >> plain
       
   190 done
       
   191 
       
   192 echo % record beginning, middle
       
   193 
       
   194 hg record -d '14 0' -m middle-only plain <<EOF
       
   195 y
       
   196 y
       
   197 y
       
   198 n
       
   199 EOF
       
   200 echo; hg tip -p
       
   201 
       
   202 echo % record end
       
   203 
       
   204 hg record -d '15 0' -m end-only plain <<EOF
       
   205 y
       
   206 y
       
   207 EOF
       
   208 echo; hg tip -p
       
   209 
       
   210 mkdir subdir
       
   211 cd subdir
       
   212 echo a > a
       
   213 hg ci -d '16 0' -Amsubdir
       
   214 
       
   215 echo a >> a
       
   216 hg record -d '16 0' -m subdir-change a <<EOF
       
   217 y
       
   218 y
       
   219 EOF
       
   220 echo; hg tip -p
       
   221 
       
   222 echo a > f1
       
   223 echo b > f2
       
   224 hg add f1 f2
       
   225 
       
   226 hg ci -mz -d '17 0'
       
   227 
       
   228 echo a >> f1
       
   229 echo b >> f2
       
   230 
       
   231 echo % help, quit
       
   232 
       
   233 hg record <<EOF
       
   234 ?
       
   235 q
       
   236 EOF
       
   237 
       
   238 echo % skip
       
   239 
       
   240 hg record <<EOF
       
   241 s
       
   242 EOF
       
   243 
       
   244 echo % no
       
   245 
       
   246 hg record <<EOF
       
   247 n
       
   248 EOF
       
   249 
       
   250 echo % f, quit
       
   251 
       
   252 hg record <<EOF
       
   253 f
       
   254 q
       
   255 EOF
       
   256 
       
   257 echo % s, all
       
   258 
       
   259 hg record -d '18 0' -mx <<EOF
       
   260 s
       
   261 a
       
   262 EOF
       
   263 echo; hg tip -p
       
   264 
       
   265 echo % f
       
   266 
       
   267 hg record -d '19 0' -my <<EOF
       
   268 f
       
   269 EOF
       
   270 echo; hg tip -p
       
   271 
       
   272 echo % preserve chmod +x
       
   273 
       
   274 chmod +x f1
       
   275 echo a >> f1
       
   276 hg record -d '20 0' -mz <<EOF
       
   277 y
       
   278 y
       
   279 y
       
   280 EOF
       
   281 echo; hg tip --config diff.git=True -p
       
   282 
       
   283 echo % preserve execute permission on original
       
   284 
       
   285 echo b >> f1
       
   286 hg record -d '21 0' -maa <<EOF
       
   287 y
       
   288 y
       
   289 y
       
   290 EOF
       
   291 echo; hg tip --config diff.git=True -p
       
   292 
       
   293 echo % preserve chmod -x
       
   294 
       
   295 chmod -x f1
       
   296 echo c >> f1
       
   297 hg record -d '22 0' -mab <<EOF
       
   298 y
       
   299 y
       
   300 y
       
   301 EOF
       
   302 echo; hg tip --config diff.git=True -p
       
   303 
       
   304 cd ..
       
   305 
       
   306 echo % abort early when a merge is in progress
       
   307 hg up 4
       
   308 touch iwillmergethat
       
   309 hg add iwillmergethat
       
   310 hg branch thatbranch
       
   311 hg ci -m'new head'
       
   312 hg up default
       
   313 hg merge thatbranch
       
   314 echo; hg record -m'will abort'
       
   315 hg up -C
       
   316 
       
   317 echo % with win32ext
       
   318 echo '[extensions]' >> .hg/hgrc
       
   319 echo 'win32text = ' >> .hg/hgrc
       
   320 echo '[decode]' >> .hg/hgrc
       
   321 echo '** = cleverdecode:' >> .hg/hgrc
       
   322 echo '[encode]' >> .hg/hgrc
       
   323 echo '** = cleverencode:' >> .hg/hgrc
       
   324 echo '[patch]' >> .hg/hgrc
       
   325 echo 'eol = crlf' >> .hg/hgrc
       
   326 
       
   327 echo d >> subdir/f1
       
   328 hg record -d '23 0' -mw1 <<EOF
       
   329 y
       
   330 y
       
   331 EOF
       
   332 echo; hg tip -p