tests/test-merge1.t
changeset 25753 fe03f522dda9
parent 25382 6084926366b9
child 26587 56b2bcea2529
--- a/tests/test-merge1.t	Wed Jul 08 17:01:09 2015 +0900
+++ b/tests/test-merge1.t	Wed Jul 08 17:01:09 2015 +0900
@@ -206,4 +206,91 @@
   $ hg revert -r -2 b
   $ hg up -q -- -2
 
+Test that updated files are treated as "modified", when
+'merge.update()' is aborted before 'merge.recordupdates()' (= parents
+aren't changed), even if none of mode, size and timestamp of them
+isn't changed on the filesystem (see also issue4583).
+
+  $ cat > $TESTTMP/abort.py <<EOF
+  > # emulate aborting before "recordupdates()". in this case, files
+  > # are changed without updating dirstate
+  > from mercurial import extensions, merge, util
+  > def applyupdates(orig, *args, **kwargs):
+  >     orig(*args, **kwargs)
+  >     raise util.Abort('intentional aborting')
+  > def extsetup(ui):
+  >     extensions.wrapfunction(merge, "applyupdates", applyupdates)
+  > EOF
+
+  $ cat >> .hg/hgrc <<EOF
+  > [fakedirstatewritetime]
+  > # emulate invoking dirstate.write() via repo.status()
+  > # at 2000-01-01 00:00
+  > fakenow = 200001010000
+  > EOF
+
+(file gotten from other revision)
+
+  $ hg update -q -C 2
+  $ echo 'THIS IS FILE B5' > b
+  $ hg commit -m 'commit #5'
+
+  $ hg update -q -C 3
+  $ cat b
+  This is file b1
+  $ touch -t 200001010000 b
+  $ hg debugrebuildstate
+
+  $ cat >> .hg/hgrc <<EOF
+  > [extensions]
+  > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
+  > abort = $TESTTMP/abort.py
+  > EOF
+  $ hg merge 5
+  abort: intentional aborting
+  [255]
+  $ cat >> .hg/hgrc <<EOF
+  > [extensions]
+  > fakedirstatewritetime = !
+  > abort = !
+  > EOF
+
+  $ cat b
+  THIS IS FILE B5
+  $ touch -t 200001010000 b
+  $ hg status -A b
+  M b
+
+(file merged from other revision)
+
+  $ hg update -q -C 3
+  $ echo 'this is file b6' > b
+  $ hg commit -m 'commit #6'
+  created new head
+
+  $ cat b
+  this is file b6
+  $ touch -t 200001010000 b
+  $ hg debugrebuildstate
+
+  $ cat >> .hg/hgrc <<EOF
+  > [extensions]
+  > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
+  > abort = $TESTTMP/abort.py
+  > EOF
+  $ hg merge --tool internal:other 5
+  abort: intentional aborting
+  [255]
+  $ cat >> .hg/hgrc <<EOF
+  > [extensions]
+  > fakedirstatewritetime = !
+  > abort = !
+  > EOF
+
+  $ cat b
+  THIS IS FILE B5
+  $ touch -t 200001010000 b
+  $ hg status -A b
+  M b
+
   $ cd ..