tests/test-amend-subrepo.t
branchstable
changeset 34976 3f909147a2c3
child 34978 691524f0bbf6
equal deleted inserted replaced
34975:5f40efa472db 34976:3f909147a2c3
       
     1 #testcases obsstore-off obsstore-on
       
     2 
       
     3   $ cat << EOF >> $HGRCPATH
       
     4   > [extensions]
       
     5   > amend =
       
     6   > EOF
       
     7 
       
     8 #if obsstore-on
       
     9   $ cat << EOF >> $HGRCPATH
       
    10   > [experimental]
       
    11   > evolution.createmarkers = True
       
    12   > EOF
       
    13 #endif
       
    14 
       
    15 Prepare parent repo
       
    16 -------------------
       
    17 
       
    18   $ hg init r
       
    19   $ cd r
       
    20 
       
    21   $ echo a > a
       
    22   $ hg ci -Am0
       
    23   adding a
       
    24 
       
    25 Link first subrepo
       
    26 ------------------
       
    27 
       
    28   $ echo 's = s' >> .hgsub
       
    29   $ hg add .hgsub
       
    30   $ hg init s
       
    31 
       
    32 amend without .hgsub
       
    33 
       
    34 BROKEN: should say "can't commit subrepos without .hgsub"
       
    35   $ hg amend s
       
    36   nothing changed
       
    37   [1]
       
    38 
       
    39 amend with subrepo
       
    40 
       
    41 BROKEN: should update .hgsubstate
       
    42   $ hg amend
       
    43   saved backup bundle to * (glob) (obsstore-off !)
       
    44   $ hg status --change .
       
    45   A .hgsub
       
    46   A a
       
    47 
       
    48 FIX UP .hgsubstate
       
    49 
       
    50   $ hg ci -mfix
       
    51   $ hg rollback -q
       
    52   $ hg add .hgsubstate
       
    53   $ hg amend
       
    54   saved backup bundle to * (glob) (obsstore-off !)
       
    55 
       
    56   $ cat .hgsubstate
       
    57   0000000000000000000000000000000000000000 s
       
    58 
       
    59 Update subrepo
       
    60 --------------
       
    61 
       
    62 add new commit to be amended
       
    63 
       
    64   $ echo a >> a
       
    65   $ hg ci -m1
       
    66 
       
    67 amend with dirty subrepo
       
    68 
       
    69   $ echo a >> s/a
       
    70   $ hg add -R s
       
    71   adding s/a
       
    72 BROKEN: should say "uncommitted changes in subrepository"
       
    73   $ hg amend
       
    74   nothing changed
       
    75   [1]
       
    76 
       
    77 amend with modified subrepo
       
    78 
       
    79   $ hg ci -R s -m0
       
    80 BROKEN: should update .hgsubstate
       
    81   $ hg amend
       
    82   nothing changed
       
    83   [1]
       
    84   $ hg status --change .
       
    85   M a
       
    86 
       
    87 FIX UP .hgsubstate
       
    88 
       
    89   $ hg ci -mfix
       
    90   $ hg rollback -q
       
    91   $ hg amend
       
    92   saved backup bundle to * (glob) (obsstore-off !)
       
    93 
       
    94   $ cat .hgsubstate
       
    95   f7b1eb17ad24730a1651fccd46c43826d1bbc2ac s
       
    96 
       
    97 revert subrepo change
       
    98 
       
    99   $ hg up -R s -q null
       
   100 BROKEN: should update .hgsubstate
       
   101   $ hg amend
       
   102   nothing changed
       
   103   [1]
       
   104 
       
   105 FIX UP .hgsubstate
       
   106 
       
   107   $ hg ci -mfix
       
   108   $ hg rollback -q
       
   109   $ hg amend
       
   110   saved backup bundle to * (glob) (obsstore-off !)
       
   111 
       
   112   $ hg status --change .
       
   113   M a
       
   114 
       
   115 Link another subrepo
       
   116 --------------------
       
   117 
       
   118 add new commit to be amended
       
   119 
       
   120   $ echo b >> b
       
   121   $ hg ci -qAm2
       
   122 
       
   123 also checks if non-subrepo change is included
       
   124 
       
   125   $ echo a >> a
       
   126 
       
   127 amend with another subrepo
       
   128 
       
   129   $ hg init t
       
   130   $ echo b >> t/b
       
   131   $ hg ci -R t -Am0
       
   132   adding b
       
   133   $ echo 't = t' >> .hgsub
       
   134 BROKEN: should update .hgsubstate
       
   135   $ hg amend
       
   136   saved backup bundle to * (glob) (obsstore-off !)
       
   137   $ hg status --change .
       
   138   M .hgsub
       
   139   M a
       
   140   A b
       
   141 
       
   142 FIX UP .hgsubstate
       
   143 
       
   144   $ hg ci -mfix
       
   145   $ hg rollback -q
       
   146   $ hg amend
       
   147   saved backup bundle to * (glob) (obsstore-off !)
       
   148 
       
   149   $ cat .hgsubstate
       
   150   0000000000000000000000000000000000000000 s
       
   151   bfb1a4fb358498a9533dabf4f2043d94162f1fcd t
       
   152 
       
   153 Unlink one subrepo
       
   154 ------------------
       
   155 
       
   156 add new commit to be amended
       
   157 
       
   158   $ echo a >> a
       
   159   $ hg ci -m3
       
   160 
       
   161 amend with one subrepo dropped
       
   162 
       
   163   $ echo 't = t' > .hgsub
       
   164 BROKEN: should update .hgsubstate
       
   165   $ hg amend
       
   166   saved backup bundle to * (glob) (obsstore-off !)
       
   167   $ hg status --change .
       
   168   M .hgsub
       
   169   M a
       
   170 
       
   171 FIX UP .hgsubstate
       
   172 
       
   173   $ echo 's = s' > .hgsub
       
   174   $ hg amend -q
       
   175   $ echo 't = t' > .hgsub
       
   176   $ hg ci -mfix
       
   177   $ hg rollback -q
       
   178   $ hg amend
       
   179   saved backup bundle to * (glob) (obsstore-off !)
       
   180 
       
   181   $ cat .hgsubstate
       
   182   bfb1a4fb358498a9533dabf4f2043d94162f1fcd t
       
   183 
       
   184 Unlink subrepos completely
       
   185 --------------------------
       
   186 
       
   187 add new commit to be amended
       
   188 
       
   189   $ echo a >> a
       
   190   $ hg ci -m3
       
   191 
       
   192 amend with .hgsub removed
       
   193 
       
   194   $ hg rm .hgsub
       
   195 BROKEN: should update .hgsubstate
       
   196   $ hg amend
       
   197   saved backup bundle to * (glob) (obsstore-off !)
       
   198   $ hg status --change .
       
   199   M a
       
   200   R .hgsub
       
   201 
       
   202 FIX UP .hgsubstate
       
   203 
       
   204   $ hg forget .hgsubstate
       
   205   $ hg amend
       
   206   saved backup bundle to * (glob) (obsstore-off !)
       
   207 
       
   208   $ hg status --change .
       
   209   M a
       
   210   R .hgsub
       
   211   R .hgsubstate
       
   212 
       
   213   $ cd ..