tests/test-uncommit.t
branchstable
changeset 3183 884a3b8aadd6
parent 2788 554c069cdc85
child 2802 41c9a4df628e
child 2835 20c2499ce8bc
equal deleted inserted replaced
2722:44a6e6fbf80b 3183:884a3b8aadd6
     1   $ cat >> $HGRCPATH <<EOF
     1   $ cat >> $HGRCPATH <<EOF
     2   > [extensions]
     2   > [extensions]
     3   > hgext.graphlog=
       
     4   > EOF
     3   > EOF
     5   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
     4   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
     6 
     5 
     7   $ glog() {
     6   $ glog() {
     8   >   hg glog --template '{rev}:{node|short}@{branch}({separate("/", obsolete, phase)}) {desc|firstline}\n' "$@"
     7   >   hg log -G --template '{rev}:{node|short}@{branch}({separate("/", obsolete, phase)}) {desc|firstline}\n' "$@"
     9   > }
     8   > }
    10 
     9 
    11   $ hg init repo
    10   $ hg init repo
    12   $ cd repo
    11   $ cd repo
    13 
    12 
    14 Cannot uncommit null changeset
    13 Cannot uncommit null changeset
    15 
    14 
    16   $ hg uncommit
    15   $ hg uncommit
    17   abort: cannot rewrite immutable changeset
    16   abort: cannot uncommit the null revision
       
    17   (no changeset checked out)
    18   [255]
    18   [255]
    19 
    19 
    20 Cannot uncommit public changeset
    20 Cannot uncommit public changeset
    21 
    21 
    22   $ echo a > a
    22   $ echo a > a
    23   $ hg ci -Am adda a
    23   $ hg ci -Am adda a
    24   $ hg phase --public .
    24   $ hg phase --public .
    25   $ hg uncommit
    25   $ hg uncommit
    26   abort: cannot rewrite immutable changeset
    26   abort: cannot uncommit public changesets: 07f494440405
       
    27   (see 'hg help phases' for details)
    27   [255]
    28   [255]
    28   $ hg phase --force --draft .
    29   $ hg phase --force --draft .
    29 
    30 
    30 Cannot uncommit merge
    31 Cannot uncommit merge
    31 
    32 
   356   b: no such file in rev 5b27f6b17da2
   357   b: no such file in rev 5b27f6b17da2
   357   [1]
   358   [1]
   358 
   359 
   359 Test uncommiting precursors
   360 Test uncommiting precursors
   360 
   361 
   361   $ hg uncommit --hidden --rev 'precursors(.)' b
   362   $ hg uncommit --hidden --rev 'precursors(.)' b --traceback
   362   $ hg cat b --rev .
   363   $ hg cat b --rev .
   363   b
   364   b
   364   b
   365   b
       
   366 
       
   367 Test date, message and user update
       
   368 
       
   369   $ hg log -r .
       
   370   changeset:   12:912ed871207c
       
   371   branch:      bar
       
   372   tag:         tip
       
   373   parent:      7:4f1c269eab68
       
   374   user:        test
       
   375   date:        Thu Jan 01 00:00:00 1970 +0000
       
   376   summary:     touncommit
       
   377   
       
   378   $ hg uncommit -m 'to-uncommit' d --user test2 --date '1337 0'
       
   379   $ hg log -r .
       
   380   changeset:   13:f1efd9ec508c
       
   381   branch:      bar
       
   382   tag:         tip
       
   383   parent:      7:4f1c269eab68
       
   384   user:        test2
       
   385   date:        Thu Jan 01 00:22:17 1970 +0000
       
   386   summary:     to-uncommit
       
   387   
       
   388 
       
   389 test -U option
       
   390 
       
   391   $ hg uncommit -U b
       
   392   $ hg log -r .
       
   393   changeset:   14:288da4a95941
       
   394   branch:      bar
       
   395   tag:         tip
       
   396   parent:      7:4f1c269eab68
       
   397   user:        test
       
   398   date:        Thu Jan 01 00:22:17 1970 +0000
       
   399   summary:     to-uncommit
       
   400   
       
   401 
       
   402 test the `hg amend --extract` entry point
       
   403 
       
   404   $ hg status --change .
       
   405   M j
       
   406   M o
       
   407   A e
       
   408   A ff
       
   409   A h
       
   410   A k
       
   411   A l
       
   412   R c
       
   413   R f
       
   414   R g
       
   415   R m
       
   416   R n
       
   417   $ hg status
       
   418   M d
       
   419   A aa
       
   420   R b
       
   421   $ hg amend --extract j
       
   422   $ hg status --change .
       
   423   M o
       
   424   A e
       
   425   A ff
       
   426   A h
       
   427   A k
       
   428   A l
       
   429   R c
       
   430   R f
       
   431   R g
       
   432   R m
       
   433   R n
       
   434   $ hg status
       
   435   M d
       
   436   M j
       
   437   A aa
       
   438   R b
       
   439 
       
   440 (with all)
       
   441 
       
   442   $ hg amend --extract --all
       
   443   new changeset is empty
       
   444   (use 'hg prune .' to remove it)
       
   445   $ hg status --change .
       
   446   $ hg status
       
   447   M d
       
   448   M j
       
   449   M o
       
   450   A aa
       
   451   A e
       
   452   A ff
       
   453   A h
       
   454   A k
       
   455   A l
       
   456   R b
       
   457   R c
       
   458   R f
       
   459   R g
       
   460   R m
       
   461   R n