tests/test-uncommit.t
changeset 42051 f4147ca63d39
parent 41888 6a944bf4c43a
child 42902 ff1ff2aae132
equal deleted inserted replaced
42050:03f6480bfdda 42051:f4147ca63d39
   100   $ hg commit -m 'new change abcde'
   100   $ hg commit -m 'new change abcde'
   101   $ hg status
   101   $ hg status
   102   $ hg heads -T '{rev}:{node} {desc}'
   102   $ hg heads -T '{rev}:{node} {desc}'
   103   5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde (no-eol)
   103   5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde (no-eol)
   104 
   104 
   105 Uncommit of non-existent and unchanged files has no effect
   105 Uncommit of non-existent and unchanged files aborts
   106   $ hg uncommit nothinghere
   106   $ hg uncommit nothinghere
   107   nothing to uncommit
   107   abort: cannot uncommit "nothinghere"
   108   [1]
   108   (file does not exist)
       
   109   [255]
   109   $ hg status
   110   $ hg status
   110   $ hg uncommit file-abc
   111   $ hg uncommit file-abc
   111   nothing to uncommit
   112   abort: cannot uncommit "file-abc"
   112   [1]
   113   (file was not changed in working directory parent)
       
   114   [255]
   113   $ hg status
   115   $ hg status
   114 
   116 
   115 Try partial uncommit, also moves bookmark
   117 Try partial uncommit, also moves bookmark
   116 
   118 
   117   $ hg bookmark
   119   $ hg bookmark
   511   parent:      -1:000000000000
   513   parent:      -1:000000000000
   512   user:        test
   514   user:        test
   513   date:        Thu Jan 01 00:00:00 1970 +0000
   515   date:        Thu Jan 01 00:00:00 1970 +0000
   514   summary:     add a
   516   summary:     add a
   515   
   517   
       
   518 Removes can be uncommitted
       
   519 
       
   520   $ hg ci -m 'modified b'
       
   521   $ hg rm b
       
   522   $ hg ci -m 'remove b'
       
   523   $ hg uncommit b
       
   524   note: keeping empty commit
       
   525   $ hg status
       
   526   R b
       
   527 
       
   528 Uncommitting a directory won't run afoul of the checks that an explicit file
       
   529 can be uncommitted.
       
   530 
       
   531   $ mkdir dir
       
   532   $ echo 1 > dir/file.txt
       
   533   $ hg ci -Aqm 'add file in directory'
       
   534   $ hg uncommit dir
       
   535   $ hg status
       
   536   A dir/file.txt
       
   537 
       
   538 `uncommit <dir>` and `cd <dir> && uncommit .` behave the same...
       
   539 
       
   540   $ hg rollback -q --config ui.rollback=True
       
   541   $ echo 2 > dir/file2.txt
       
   542   $ hg ci -Aqm 'add file2 in directory'
       
   543   $ hg uncommit dir
       
   544   note: keeping empty commit
       
   545   $ hg status
       
   546   A dir/file2.txt
       
   547 
       
   548   $ hg rollback -q --config ui.rollback=True
       
   549   $ cd dir
       
   550   $ hg uncommit .
       
   551   note: keeping empty commit
       
   552   $ hg status
       
   553   A dir/file2.txt
       
   554   $ cd ..
       
   555 
       
   556 ... and errors out the same way when nothing can be uncommitted
       
   557 
       
   558   $ hg rollback -q --config ui.rollback=True
       
   559   $ mkdir emptydir
       
   560   $ hg uncommit emptydir
       
   561   abort: cannot uncommit "emptydir"
       
   562   (file was untracked in working directory parent)
       
   563   [255]
       
   564 
       
   565   $ cd emptydir
       
   566   $ hg uncommit .
       
   567   abort: cannot uncommit "emptydir"
       
   568   (file was untracked in working directory parent)
       
   569   [255]
       
   570   $ hg status
       
   571   $ cd ..