[PATCH 2 of 4] tests: add test for merging flags across renames

Laurens Holst laurens.nospam at grauw.nl
Tue Dec 27 15:31:04 CST 2011


# HG changeset patch
# User Laurens Holst <laurens.hg at grauw.nl>
# Date 1325009759 -3600
# Node ID 1d836a646d9e5d26843e461b8d43f77d694df0b9
# Parent  3317d5c34f384c6d1d8440e19980a2261beecc7a
tests: add test for merging flags across renames

diff -r 3317d5c34f38 -r 1d836a646d9e tests/test-merge-types.t
--- a/tests/test-merge-types.t	Wed Dec 21 18:20:15 2011 +0100
+++ b/tests/test-merge-types.t	Tue Dec 27 19:15:59 2011 +0100
@@ -3,8 +3,11 @@
   $ hg init
 
   $ echo a > a
+  $ mkdir dir
+  $ echo a > dir/a
   $ hg ci -Amadd
   adding a
+  adding dir/a
 
   $ chmod +x a
   $ hg ci -mexecutable
@@ -20,7 +23,7 @@
     searching for copies back to rev 1
   resolving manifests
    overwrite: False, partial: False
-   ancestor: c334dc3be0da, local: 521a1e40188f+, remote: 3574f3e69b1c
+   ancestor: dc8452f1f7df, local: 300b353ff13f+, remote: 5d0a685473c5
    conflicting flags for a
   (n)one, e(x)ec or sym(l)ink? n
    a: update permissions -> e
@@ -48,7 +51,7 @@
     searching for copies back to rev 1
   resolving manifests
    overwrite: False, partial: False
-   ancestor: c334dc3be0da, local: 3574f3e69b1c+, remote: 521a1e40188f
+   ancestor: dc8452f1f7df, local: 5d0a685473c5+, remote: 300b353ff13f
    conflicting flags for a
   (n)one, e(x)ec or sym(l)ink? n
    a: remote is newer -> g
@@ -70,3 +73,207 @@
   > fi
   a has no flags (default for conflicts)
 
+Executable in other parent, moved in local:
+
+  $ hg up 0 -C
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg mv a b
+  $ hg ci -mmove
+  created new head
+  $ hg merge -r 1 --debug
+    searching for copies back to rev 1
+    unmatched files in local:
+     b
+    all copies found (* = to merge, ! = divergent):
+     b -> a 
+    checking for directory renames
+  resolving manifests
+   overwrite: False, partial: False
+   ancestor: dc8452f1f7df, local: f95452bac98f+, remote: 5d0a685473c5
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ if [ ! -f b ]; then
+  >    echo b does not exist
+  > elif [ -h b ]; then
+  >    echo b is a symlink
+  >    $TESTDIR/readlink.py b
+  > elif [ -x b ]; then
+  >     echo b is executable
+  > else
+  >     echo b has no flags
+  > fi
+  b has no flags
+
+Executable in local, moved in other parent:
+
+  $ hg up 1 -C
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg merge -r 3 --debug
+    searching for copies back to rev 1
+    unmatched files in other:
+     b
+    all copies found (* = to merge, ! = divergent):
+     b -> a 
+    checking for directory renames
+  resolving manifests
+   overwrite: False, partial: False
+   ancestor: dc8452f1f7df, local: 5d0a685473c5+, remote: f95452bac98f
+   a: other deleted -> r
+   b: remote created -> g
+  updating: a 1/2 files (50.00%)
+  removing a
+  updating: b 2/2 files (100.00%)
+  getting b
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ if [ ! -f b ]; then
+  >    echo b does not exist
+  > elif [ -h b ]; then
+  >    echo b is a symlink
+  >    $TESTDIR/readlink.py b
+  > elif [ -x b ]; then
+  >     echo b is executable
+  > else
+  >     echo b has no flags
+  > fi
+  b has no flags
+
+Executable in other parent, copied in local:
+
+  $ hg up 0 -C
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg cp a b
+  $ hg ci -mmove
+  created new head
+  $ hg merge -r 1 --debug
+    searching for copies back to rev 1
+    unmatched files in local:
+     b
+    all copies found (* = to merge, ! = divergent):
+     b -> a 
+    checking for directory renames
+  resolving manifests
+   overwrite: False, partial: False
+   ancestor: dc8452f1f7df, local: a810d3446267+, remote: 5d0a685473c5
+   a: update permissions -> e
+  updating: a 1/1 files (100.00%)
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ if [ ! -f b ]; then
+  >    echo b does not exist
+  > elif [ -h b ]; then
+  >    echo b is a symlink
+  >    $TESTDIR/readlink.py b
+  > elif [ -x b ]; then
+  >     echo b is executable
+  > else
+  >     echo b has no flags
+  > fi
+  b has no flags
+
+Executable in local, copied in other parent:
+
+  $ hg up 1 -C
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg merge -r 4 --debug
+    searching for copies back to rev 1
+    unmatched files in other:
+     b
+    all copies found (* = to merge, ! = divergent):
+     b -> a 
+    checking for directory renames
+  resolving manifests
+   overwrite: False, partial: False
+   ancestor: dc8452f1f7df, local: 5d0a685473c5+, remote: a810d3446267
+   b: remote created -> g
+  updating: b 1/1 files (100.00%)
+  getting b
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ if [ ! -f b ]; then
+  >    echo b does not exist
+  > elif [ -h b ]; then
+  >    echo b is a symlink
+  >    $TESTDIR/readlink.py b
+  > elif [ -x b ]; then
+  >     echo b is executable
+  > else
+  >     echo b has no flags
+  > fi
+  b has no flags
+
+Executable in other parent, directory rename in local:
+
+  $ hg up 0 -C
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg mv dir dir2
+  moving dir/a to dir2/a
+  $ hg ci -mdirectorymove
+  created new head
+  $ hg merge -r 1 --debug
+    searching for copies back to rev 1
+    unmatched files in local:
+     dir2/a
+    all copies found (* = to merge, ! = divergent):
+     dir2/a -> dir/a 
+    checking for directory renames
+    dir dir/ -> dir2/
+  resolving manifests
+   overwrite: False, partial: False
+   ancestor: dc8452f1f7df, local: b3f243fb658c+, remote: 5d0a685473c5
+   a: update permissions -> e
+  updating: a 1/1 files (100.00%)
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ if [ ! -f dir2/a ]; then
+  >    echo dir2/a does not exist
+  > elif [ -h dir2/a ]; then
+  >    echo dir2/a is a symlink
+  >    $TESTDIR/readlink.py dir2/a
+  > elif [ -x dir2/a ]; then
+  >     echo dir2/a is executable
+  > else
+  >     echo dir2/a has no flags
+  > fi
+  dir2/a has no flags
+
+Executable in local, directory rename in other parent:
+
+  $ hg up 1 -C
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg merge -r 5 --debug
+    searching for copies back to rev 1
+    unmatched files in other:
+     dir2/a
+    all copies found (* = to merge, ! = divergent):
+     dir2/a -> dir/a 
+    checking for directory renames
+    dir dir/ -> dir2/
+  resolving manifests
+   overwrite: False, partial: False
+   ancestor: dc8452f1f7df, local: 5d0a685473c5+, remote: b3f243fb658c
+   dir/a: other deleted -> r
+   dir2/a: remote created -> g
+  updating: dir/a 1/2 files (50.00%)
+  removing dir/a
+  updating: dir2/a 2/2 files (100.00%)
+  getting dir2/a
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ if [ ! -f dir2/a ]; then
+  >    echo dir2/a does not exist
+  > elif [ -h dir2/a ]; then
+  >    echo dir2/a is a symlink
+  >    $TESTDIR/readlink.py dir2/a
+  > elif [ -x dir2/a ]; then
+  >     echo dir2/a is executable
+  > else
+  >     echo dir2/a has no flags
+  > fi
+  dir2/a has no flags


More information about the Mercurial-devel mailing list