tests/test-revert-interactive.t
branchstable
changeset 24803 e89f909edffa
parent 24698 a85c4ed1132f
child 25258 f37a69ec3f47
equal deleted inserted replaced
24753:612ed41ae359 24803:e89f909edffa
       
     1 Revert interactive tests
       
     2 1 add and commit file f
       
     3 2 add commit file folder1/g
       
     4 3 add and commit file folder2/h
       
     5 4 add and commit file folder1/i
       
     6 5 commit change to file f
       
     7 6 commit changes to files folder1/g folder2/h
       
     8 7 commit changes to files folder1/g folder2/h
       
     9 8 revert interactive to commit id 2 (line 3 above), check that folder1/i is removed and
       
    10 9 make workdir match 7
       
    11 10 run the same test than 8 from within folder1 and check same expectations
       
    12 
       
    13   $ cat <<EOF >> $HGRCPATH
       
    14   > [ui]
       
    15   > interactive = true
       
    16   > [extensions]
       
    17   > record =
       
    18   > EOF
       
    19 
       
    20 
       
    21   $ mkdir -p a/folder1 a/folder2
       
    22   $ cd a
       
    23   $ hg init
       
    24   >>> open('f', 'wb').write("1\n2\n3\n4\n5\n")
       
    25   $ hg add f ; hg commit -m "adding f"
       
    26   $ cat f > folder1/g ; hg add folder1/g ; hg commit -m "adding folder1/g"
       
    27   $ cat f > folder2/h ; hg add folder2/h ; hg commit -m "adding folder2/h"
       
    28   $ cat f > folder1/i ; hg add folder1/i ; hg commit -m "adding folder1/i"
       
    29   >>> open('f', 'wb').write("a\n1\n2\n3\n4\n5\nb\n")
       
    30   $ hg commit -m "modifying f"
       
    31   >>> open('folder1/g', 'wb').write("c\n1\n2\n3\n4\n5\nd\n")
       
    32   $ hg commit -m "modifying folder1/g"
       
    33   >>> open('folder2/h', 'wb').write("e\n1\n2\n3\n4\n5\nf\n")
       
    34   $ hg commit -m "modifying folder2/h"
       
    35   $ hg tip
       
    36   changeset:   6:59dd6e4ab63a
       
    37   tag:         tip
       
    38   user:        test
       
    39   date:        Thu Jan 01 00:00:00 1970 +0000
       
    40   summary:     modifying folder2/h
       
    41   
       
    42   $ hg revert -i -r 2 --all -- << EOF
       
    43   > y
       
    44   > y
       
    45   > y
       
    46   > y
       
    47   > y
       
    48   > n
       
    49   > n
       
    50   > EOF
       
    51   reverting f
       
    52   reverting folder1/g (glob)
       
    53   removing folder1/i (glob)
       
    54   reverting folder2/h (glob)
       
    55   diff -r 89ac3d72e4a4 f
       
    56   2 hunks, 2 lines changed
       
    57   examine changes to 'f'? [Ynesfdaq?] y
       
    58   
       
    59   @@ -1,6 +1,5 @@
       
    60   -a
       
    61    1
       
    62    2
       
    63    3
       
    64    4
       
    65    5
       
    66   record change 1/6 to 'f'? [Ynesfdaq?] y
       
    67   
       
    68   @@ -2,6 +1,5 @@
       
    69    1
       
    70    2
       
    71    3
       
    72    4
       
    73    5
       
    74   -b
       
    75   record change 2/6 to 'f'? [Ynesfdaq?] y
       
    76   
       
    77   diff -r 89ac3d72e4a4 folder1/g
       
    78   2 hunks, 2 lines changed
       
    79   examine changes to 'folder1/g'? [Ynesfdaq?] y
       
    80   
       
    81   @@ -1,6 +1,5 @@
       
    82   -c
       
    83    1
       
    84    2
       
    85    3
       
    86    4
       
    87    5
       
    88   record change 3/6 to 'folder1/g'? [Ynesfdaq?] y
       
    89   
       
    90   @@ -2,6 +1,5 @@
       
    91    1
       
    92    2
       
    93    3
       
    94    4
       
    95    5
       
    96   -d
       
    97   record change 4/6 to 'folder1/g'? [Ynesfdaq?] n
       
    98   
       
    99   diff -r 89ac3d72e4a4 folder2/h
       
   100   2 hunks, 2 lines changed
       
   101   examine changes to 'folder2/h'? [Ynesfdaq?] n
       
   102   
       
   103   $ cat f
       
   104   1
       
   105   2
       
   106   3
       
   107   4
       
   108   5
       
   109   $ cat folder1/g
       
   110   1
       
   111   2
       
   112   3
       
   113   4
       
   114   5
       
   115   d
       
   116   $ cat folder2/h
       
   117   e
       
   118   1
       
   119   2
       
   120   3
       
   121   4
       
   122   5
       
   123   f
       
   124 
       
   125 Test that --interactive lift the need for --all
       
   126 
       
   127   $ echo q | hg revert -i -r 2
       
   128   reverting folder1/g (glob)
       
   129   reverting folder2/h (glob)
       
   130   diff -r 89ac3d72e4a4 folder1/g
       
   131   1 hunks, 1 lines changed
       
   132   examine changes to 'folder1/g'? [Ynesfdaq?] q
       
   133   
       
   134   abort: user quit
       
   135   [255]
       
   136   $ rm folder1/g.orig
       
   137 
       
   138 
       
   139   $ hg update -C 6
       
   140   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   141   $ hg revert -i -r 2 --all -- << EOF
       
   142   > y
       
   143   > y
       
   144   > y
       
   145   > y
       
   146   > y
       
   147   > n
       
   148   > n
       
   149   > EOF
       
   150   reverting f
       
   151   reverting folder1/g (glob)
       
   152   removing folder1/i (glob)
       
   153   reverting folder2/h (glob)
       
   154   diff -r 89ac3d72e4a4 f
       
   155   2 hunks, 2 lines changed
       
   156   examine changes to 'f'? [Ynesfdaq?] y
       
   157   
       
   158   @@ -1,6 +1,5 @@
       
   159   -a
       
   160    1
       
   161    2
       
   162    3
       
   163    4
       
   164    5
       
   165   record change 1/6 to 'f'? [Ynesfdaq?] y
       
   166   
       
   167   @@ -2,6 +1,5 @@
       
   168    1
       
   169    2
       
   170    3
       
   171    4
       
   172    5
       
   173   -b
       
   174   record change 2/6 to 'f'? [Ynesfdaq?] y
       
   175   
       
   176   diff -r 89ac3d72e4a4 folder1/g
       
   177   2 hunks, 2 lines changed
       
   178   examine changes to 'folder1/g'? [Ynesfdaq?] y
       
   179   
       
   180   @@ -1,6 +1,5 @@
       
   181   -c
       
   182    1
       
   183    2
       
   184    3
       
   185    4
       
   186    5
       
   187   record change 3/6 to 'folder1/g'? [Ynesfdaq?] y
       
   188   
       
   189   @@ -2,6 +1,5 @@
       
   190    1
       
   191    2
       
   192    3
       
   193    4
       
   194    5
       
   195   -d
       
   196   record change 4/6 to 'folder1/g'? [Ynesfdaq?] n
       
   197   
       
   198   diff -r 89ac3d72e4a4 folder2/h
       
   199   2 hunks, 2 lines changed
       
   200   examine changes to 'folder2/h'? [Ynesfdaq?] n
       
   201   
       
   202   $ cat f
       
   203   1
       
   204   2
       
   205   3
       
   206   4
       
   207   5
       
   208   $ cat folder1/g
       
   209   1
       
   210   2
       
   211   3
       
   212   4
       
   213   5
       
   214   d
       
   215   $ cat folder2/h
       
   216   e
       
   217   1
       
   218   2
       
   219   3
       
   220   4
       
   221   5
       
   222   f
       
   223   $ hg st
       
   224   M f
       
   225   M folder1/g
       
   226   R folder1/i
       
   227   $ hg revert --interactive f << EOF
       
   228   > y
       
   229   > y
       
   230   > n
       
   231   > n
       
   232   > EOF
       
   233   diff -r 59dd6e4ab63a f
       
   234   2 hunks, 2 lines changed
       
   235   examine changes to 'f'? [Ynesfdaq?] y
       
   236   
       
   237   @@ -1,5 +1,6 @@
       
   238   +a
       
   239    1
       
   240    2
       
   241    3
       
   242    4
       
   243    5
       
   244   record change 1/2 to 'f'? [Ynesfdaq?] y
       
   245   
       
   246   @@ -1,5 +2,6 @@
       
   247    1
       
   248    2
       
   249    3
       
   250    4
       
   251    5
       
   252   +b
       
   253   record change 2/2 to 'f'? [Ynesfdaq?] n
       
   254   
       
   255   $ hg st
       
   256   M f
       
   257   M folder1/g
       
   258   R folder1/i
       
   259   ? f.orig
       
   260   $ cat f
       
   261   a
       
   262   1
       
   263   2
       
   264   3
       
   265   4
       
   266   5
       
   267   $ cat f.orig
       
   268   1
       
   269   2
       
   270   3
       
   271   4
       
   272   5