tests/test-status
changeset 6200 acc40572da5b
parent 6033 a1ebd5cd7e55
child 6201 305d4450036a
equal deleted inserted replaced
6199:0068809347d7 6200:acc40572da5b
    42 touch ignoreddir/file
    42 touch ignoreddir/file
    43 echo "hg status ignoreddir/file:"
    43 echo "hg status ignoreddir/file:"
    44 hg status ignoreddir/file
    44 hg status ignoreddir/file
    45 echo "hg status -i ignoreddir/file:"
    45 echo "hg status -i ignoreddir/file:"
    46 hg status -i ignoreddir/file
    46 hg status -i ignoreddir/file
       
    47 cd ..
       
    48 
       
    49 # check 'status -q' and some combinations
       
    50 hg init repo3
       
    51 cd repo3
       
    52 touch modified removed deleted ignored
       
    53 echo "^ignored$" > .hgignore
       
    54 hg commit -A -m 'initial checkin'
       
    55 touch added unknown ignored
       
    56 hg add added
       
    57 echo "test" >> modified
       
    58 hg remove removed
       
    59 rm deleted
       
    60 hg copy modified copied
       
    61 
       
    62 # Run status with 2 different flags.
       
    63 # Check if result is the same or different.
       
    64 # If result is not as expected, raise error
       
    65 function assert {
       
    66     hg status $1 > ../a
       
    67     hg status $2 > ../b
       
    68     out=`diff ../a ../b`
       
    69     if [ $? -ne 0 ]; then
       
    70         out=1
       
    71     else
       
    72         out=0
       
    73     fi
       
    74     if [ $3 -eq 0 ]; then
       
    75         df="same"
       
    76     else
       
    77         df="different"
       
    78     fi
       
    79     if [ $out -ne $3 ]; then
       
    80         echo "Error on $1 and $2, should be $df."
       
    81     fi
       
    82 }
       
    83 
       
    84 # assert flag1 flag2 [0-same | 1-different]
       
    85 assert "-q" "-mard"     0
       
    86 assert "-A" "-mardicCu" 0
       
    87 assert "-qA" "-mardicCu" 0
       
    88 assert "-qAu" "-A"      0
       
    89 assert "-qA" "-A"       0
       
    90 assert "-qu" "-u"       0
       
    91 assert "-q" "-u"        1
       
    92 assert "-m" "-a"        1
       
    93 assert "-r" "-d"        1
       
    94