tests/test-merge1.t
changeset 48392 434de12918fd
parent 46418 dc00324e80f4
child 48876 42d2b31cee0b
equal deleted inserted replaced
48391:b80e5e75d51e 48392:434de12918fd
   347 Test that updated files are treated as "modified", when
   347 Test that updated files are treated as "modified", when
   348 'merge.update()' is aborted before 'merge.recordupdates()' (= parents
   348 'merge.update()' is aborted before 'merge.recordupdates()' (= parents
   349 aren't changed), even if none of mode, size and timestamp of them
   349 aren't changed), even if none of mode, size and timestamp of them
   350 isn't changed on the filesystem (see also issue4583).
   350 isn't changed on the filesystem (see also issue4583).
   351 
   351 
       
   352 This test is now "best effort" as the mechanism to prevent such race are
       
   353 getting better, it get more complicated to test a specific scenario that would
       
   354 trigger it. If you see flakyness here, there is a race.
       
   355 
   352   $ cat > $TESTTMP/abort.py <<EOF
   356   $ cat > $TESTTMP/abort.py <<EOF
   353   > from __future__ import absolute_import
   357   > from __future__ import absolute_import
   354   > # emulate aborting before "recordupdates()". in this case, files
   358   > # emulate aborting before "recordupdates()". in this case, files
   355   > # are changed without updating dirstate
   359   > # are changed without updating dirstate
   356   > from mercurial import (
   360   > from mercurial import (
   363   >     raise error.Abort(b'intentional aborting')
   367   >     raise error.Abort(b'intentional aborting')
   364   > def extsetup(ui):
   368   > def extsetup(ui):
   365   >     extensions.wrapfunction(merge, "applyupdates", applyupdates)
   369   >     extensions.wrapfunction(merge, "applyupdates", applyupdates)
   366   > EOF
   370   > EOF
   367 
   371 
   368   $ cat >> .hg/hgrc <<EOF
       
   369   > [fakedirstatewritetime]
       
   370   > # emulate invoking dirstate.write() via repo.status()
       
   371   > # at 2000-01-01 00:00
       
   372   > fakenow = 200001010000
       
   373   > EOF
       
   374 
       
   375 (file gotten from other revision)
   372 (file gotten from other revision)
   376 
   373 
   377   $ hg update -q -C 2
   374   $ hg update -q -C 2
   378   $ echo 'THIS IS FILE B5' > b
   375   $ echo 'THIS IS FILE B5' > b
   379   $ hg commit -m 'commit #5'
   376   $ hg commit -m 'commit #5'
   380 
   377 
   381   $ hg update -q -C 3
   378   $ hg update -q -C 3
   382   $ cat b
   379   $ cat b
   383   This is file b1
   380   This is file b1
   384   $ touch -t 200001010000 b
       
   385   $ hg debugrebuildstate
       
   386 
       
   387   $ cat >> .hg/hgrc <<EOF
   381   $ cat >> .hg/hgrc <<EOF
   388   > [extensions]
   382   > [extensions]
   389   > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
       
   390   > abort = $TESTTMP/abort.py
   383   > abort = $TESTTMP/abort.py
   391   > EOF
   384   > EOF
   392   $ hg merge 5
   385   $ hg merge 5
   393   abort: intentional aborting
   386   abort: intentional aborting
   394   [255]
   387   [255]
   395   $ cat >> .hg/hgrc <<EOF
   388   $ cat >> .hg/hgrc <<EOF
   396   > [extensions]
   389   > [extensions]
   397   > fakedirstatewritetime = !
       
   398   > abort = !
   390   > abort = !
   399   > EOF
   391   > EOF
   400 
   392 
   401   $ cat b
   393   $ cat b
   402   THIS IS FILE B5
   394   THIS IS FILE B5
   403   $ touch -t 200001010000 b
       
   404   $ hg status -A b
   395   $ hg status -A b
   405   M b
   396   M b
   406 
   397 
   407 (file merged from other revision)
   398 (file merged from other revision)
   408 
   399 
   411   $ hg commit -m 'commit #6'
   402   $ hg commit -m 'commit #6'
   412   created new head
   403   created new head
   413 
   404 
   414   $ cat b
   405   $ cat b
   415   this is file b6
   406   this is file b6
   416   $ touch -t 200001010000 b
   407   $ hg status
   417   $ hg debugrebuildstate
       
   418 
   408 
   419   $ cat >> .hg/hgrc <<EOF
   409   $ cat >> .hg/hgrc <<EOF
   420   > [extensions]
   410   > [extensions]
   421   > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
       
   422   > abort = $TESTTMP/abort.py
   411   > abort = $TESTTMP/abort.py
   423   > EOF
   412   > EOF
   424   $ hg merge --tool internal:other 5
   413   $ hg merge --tool internal:other 5
   425   abort: intentional aborting
   414   abort: intentional aborting
   426   [255]
   415   [255]
   427   $ cat >> .hg/hgrc <<EOF
   416   $ cat >> .hg/hgrc <<EOF
   428   > [extensions]
   417   > [extensions]
   429   > fakedirstatewritetime = !
       
   430   > abort = !
   418   > abort = !
   431   > EOF
   419   > EOF
   432 
   420 
   433   $ cat b
   421   $ cat b
   434   THIS IS FILE B5
   422   THIS IS FILE B5
   435   $ touch -t 200001010000 b
       
   436   $ hg status -A b
   423   $ hg status -A b
   437   M b
   424   M b
   438 
   425 
   439   $ cd ..
   426   $ cd ..