changeset 42221:c83c08cf02b7

tests: add test where copy source is deleted and added back This shows another difference between pathcopies() and mergecopies(): mergecopies() considers files that have been deleted and then added back as different files, but pathcopies() does not. Differential Revision: https://phab.mercurial-scm.org/D6330
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 29 Apr 2019 14:38:54 -0700
parents e64d8d73a98d
children 57203e0210f8
files tests/test-rename-merge1.t
diffstat 1 files changed, 49 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-rename-merge1.t	Wed May 01 14:30:25 2019 -0400
+++ b/tests/test-rename-merge1.t	Mon Apr 29 14:38:54 2019 -0700
@@ -184,3 +184,52 @@
   $ hg status
   M newfile
   $ cd ..
+
+Check that file is considered unrelated when deleted and recreated
+
+  $ hg init unrelated
+  $ cd unrelated
+  $ echo foo > file
+  $ hg add file
+  $ hg commit -m "added file"
+  $ hg cp file newfile
+  $ hg commit -m "copy file"
+  $ hg update 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg rm file
+  $ hg commit -m "deleted file"
+  created new head
+  $ echo bar > file
+  $ hg add file
+  $ hg ci -m 'recreate file'
+  $ hg log -G -T '{rev} {desc}\n'
+  @  3 recreate file
+  |
+  o  2 deleted file
+  |
+  | o  1 copy file
+  |/
+  o  0 added file
+  
+BROKEN: this is inconsistent with `hg merge` (below), which doesn't consider
+'file' renamed same since it was deleted for a while
+  $ hg st --copies --rev 3 --rev 1
+  M file
+  A newfile
+    file
+  $ hg merge --debug 1
+    unmatched files in other:
+     newfile
+    all copies found (* = to merge, ! = divergent, % = renamed and deleted):
+     src: 'file' -> dst: 'newfile' 
+    checking for directory renames
+  resolving manifests
+   branchmerge: True, force: False, partial: False
+   ancestor: 19d7f95df299, local: 4e4a42b1cbdf+, remote: 45b14aae7432
+   newfile: remote created -> g
+  getting newfile
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg status
+  M newfile
+  $ cd ..