tests/test-status.t
changeset 11782 992506c14217
parent 10014 54cd28258ea7
child 12156 4c94b6d0fb1c
equal deleted inserted replaced
11781:6f59154fb604 11782:992506c14217
       
     1   $ hg init repo1
       
     2   $ cd repo1
       
     3   $ mkdir a b a/1 b/1 b/2
       
     4   $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2
       
     5 
       
     6 hg status in repo root:
       
     7 
       
     8   $ hg status
       
     9   ? a/1/in_a_1
       
    10   ? a/in_a
       
    11   ? b/1/in_b_1
       
    12   ? b/2/in_b_2
       
    13   ? b/in_b
       
    14   ? in_root
       
    15 
       
    16 hg status . in repo root:
       
    17 
       
    18   $ hg status .
       
    19   ? a/1/in_a_1
       
    20   ? a/in_a
       
    21   ? b/1/in_b_1
       
    22   ? b/2/in_b_2
       
    23   ? b/in_b
       
    24   ? in_root
       
    25 
       
    26   $ hg status --cwd a
       
    27   ? a/1/in_a_1
       
    28   ? a/in_a
       
    29   ? b/1/in_b_1
       
    30   ? b/2/in_b_2
       
    31   ? b/in_b
       
    32   ? in_root
       
    33   $ hg status --cwd a .
       
    34   ? 1/in_a_1
       
    35   ? in_a
       
    36   $ hg status --cwd a ..
       
    37   ? 1/in_a_1
       
    38   ? in_a
       
    39   ? ../b/1/in_b_1
       
    40   ? ../b/2/in_b_2
       
    41   ? ../b/in_b
       
    42   ? ../in_root
       
    43 
       
    44   $ hg status --cwd b
       
    45   ? a/1/in_a_1
       
    46   ? a/in_a
       
    47   ? b/1/in_b_1
       
    48   ? b/2/in_b_2
       
    49   ? b/in_b
       
    50   ? in_root
       
    51   $ hg status --cwd b .
       
    52   ? 1/in_b_1
       
    53   ? 2/in_b_2
       
    54   ? in_b
       
    55   $ hg status --cwd b ..
       
    56   ? ../a/1/in_a_1
       
    57   ? ../a/in_a
       
    58   ? 1/in_b_1
       
    59   ? 2/in_b_2
       
    60   ? in_b
       
    61   ? ../in_root
       
    62 
       
    63   $ hg status --cwd a/1
       
    64   ? a/1/in_a_1
       
    65   ? a/in_a
       
    66   ? b/1/in_b_1
       
    67   ? b/2/in_b_2
       
    68   ? b/in_b
       
    69   ? in_root
       
    70   $ hg status --cwd a/1 .
       
    71   ? in_a_1
       
    72   $ hg status --cwd a/1 ..
       
    73   ? in_a_1
       
    74   ? ../in_a
       
    75 
       
    76   $ hg status --cwd b/1
       
    77   ? a/1/in_a_1
       
    78   ? a/in_a
       
    79   ? b/1/in_b_1
       
    80   ? b/2/in_b_2
       
    81   ? b/in_b
       
    82   ? in_root
       
    83   $ hg status --cwd b/1 .
       
    84   ? in_b_1
       
    85   $ hg status --cwd b/1 ..
       
    86   ? in_b_1
       
    87   ? ../2/in_b_2
       
    88   ? ../in_b
       
    89 
       
    90   $ hg status --cwd b/2
       
    91   ? a/1/in_a_1
       
    92   ? a/in_a
       
    93   ? b/1/in_b_1
       
    94   ? b/2/in_b_2
       
    95   ? b/in_b
       
    96   ? in_root
       
    97   $ hg status --cwd b/2 .
       
    98   ? in_b_2
       
    99   $ hg status --cwd b/2 ..
       
   100   ? ../1/in_b_1
       
   101   ? in_b_2
       
   102   ? ../in_b
       
   103   $ cd ..
       
   104 
       
   105   $ hg init repo2
       
   106   $ cd repo2
       
   107   $ touch modified removed deleted ignored
       
   108   $ echo "^ignored$" > .hgignore
       
   109   $ hg ci -A -m 'initial checkin' -d "1000000 0"
       
   110   adding .hgignore
       
   111   adding deleted
       
   112   adding modified
       
   113   adding removed
       
   114   $ touch modified added unknown ignored
       
   115   $ hg add added
       
   116   $ hg remove removed
       
   117   $ rm deleted
       
   118 
       
   119 hg status:
       
   120 
       
   121   $ hg status
       
   122   A added
       
   123   R removed
       
   124   ! deleted
       
   125   ? unknown
       
   126 
       
   127 hg status modified added removed deleted unknown never-existed ignored:
       
   128 
       
   129   $ hg status modified added removed deleted unknown never-existed ignored
       
   130   never-existed: No such file or directory
       
   131   A added
       
   132   R removed
       
   133   ! deleted
       
   134   ? unknown
       
   135 
       
   136   $ hg copy modified copied
       
   137 
       
   138 hg status -C:
       
   139 
       
   140   $ hg status -C
       
   141   A added
       
   142   A copied
       
   143     modified
       
   144   R removed
       
   145   ! deleted
       
   146   ? unknown
       
   147 
       
   148 hg status -A:
       
   149 
       
   150   $ hg status -A
       
   151   A added
       
   152   A copied
       
   153     modified
       
   154   R removed
       
   155   ! deleted
       
   156   ? unknown
       
   157   I ignored
       
   158   C .hgignore
       
   159   C modified
       
   160 
       
   161 
       
   162   $ echo "^ignoreddir$" > .hgignore
       
   163   $ mkdir ignoreddir
       
   164   $ touch ignoreddir/file
       
   165 
       
   166 hg status ignoreddir/file:
       
   167 
       
   168   $ hg status ignoreddir/file
       
   169 
       
   170 hg status -i ignoreddir/file:
       
   171 
       
   172   $ hg status -i ignoreddir/file
       
   173   I ignoreddir/file
       
   174   $ cd ..
       
   175 
       
   176 # check 'status -q' and some combinations
       
   177 
       
   178   $ hg init repo3
       
   179   $ cd repo3
       
   180   $ touch modified removed deleted ignored
       
   181   $ echo "^ignored$" > .hgignore
       
   182   $ hg commit -A -m 'initial checkin'
       
   183   adding .hgignore
       
   184   adding deleted
       
   185   adding modified
       
   186   adding removed
       
   187   $ touch added unknown ignored
       
   188   $ hg add added
       
   189   $ echo "test" >> modified
       
   190   $ hg remove removed
       
   191   $ rm deleted
       
   192   $ hg copy modified copied
       
   193 
       
   194 # Run status with 2 different flags.
       
   195 # Check if result is the same or different.
       
   196 # If result is not as expected, raise error
       
   197 
       
   198   $ assert() {
       
   199   >    hg status $1 > ../a
       
   200   >    hg status $2 > ../b
       
   201   >     out=`diff ../a ../b`
       
   202   >     if [ $? -ne 0 ]; then
       
   203   >         out=1
       
   204   >     else
       
   205   >         out=0
       
   206   >     fi
       
   207   >     if [ $3 -eq 0 ]; then
       
   208   >         df="same"
       
   209   >     else
       
   210   >         df="different"
       
   211   >     fi
       
   212   >     if [ $out -ne $3 ]; then
       
   213   >         echo "Error on $1 and $2, should be $df."
       
   214   >     fi
       
   215   > }
       
   216 
       
   217 # assert flag1 flag2 [0-same | 1-different]
       
   218 
       
   219   $ assert "-q" "-mard"      0
       
   220   $ assert "-A" "-marduicC"  0
       
   221   $ assert "-qA" "-mardcC"   0
       
   222   $ assert "-qAui" "-A"      0
       
   223   $ assert "-qAu" "-marducC" 0
       
   224   $ assert "-qAi" "-mardicC" 0
       
   225   $ assert "-qu" "-u"        0
       
   226   $ assert "-q" "-u"         1
       
   227   $ assert "-m" "-a"         1
       
   228   $ assert "-r" "-d"         1
       
   229   $ cd ..
       
   230 
       
   231   $ hg init repo4
       
   232   $ cd repo4
       
   233   $ touch modified removed deleted
       
   234   $ hg ci -q -A -m 'initial checkin' -d "1000000 0"
       
   235   $ touch added unknown
       
   236   $ hg add added
       
   237   $ hg remove removed
       
   238   $ rm deleted
       
   239   $ echo x > modified
       
   240   $ hg copy modified copied
       
   241   $ hg ci -m 'test checkin' -d "1000001 0"
       
   242   $ rm *
       
   243   $ touch unrelated
       
   244   $ hg ci -q -A -m 'unrelated checkin' -d "1000002 0"
       
   245 
       
   246 hg status --change 1:
       
   247 
       
   248   $ hg status --change 1
       
   249   M modified
       
   250   A added
       
   251   A copied
       
   252   R removed
       
   253 
       
   254 hg status --change 1 unrelated:
       
   255 
       
   256   $ hg status --change 1 unrelated
       
   257 
       
   258 hg status -C --change 1 added modified copied removed deleted:
       
   259 
       
   260   $ hg status -C --change 1 added modified copied removed deleted
       
   261   M modified
       
   262   A added
       
   263   A copied
       
   264     modified
       
   265   R removed
       
   266 
       
   267 hg status -A --change 1:
       
   268 
       
   269   $ hg status -A --change 1
       
   270   M modified
       
   271   A added
       
   272   A copied
       
   273     modified
       
   274   R removed
       
   275   C deleted