diff tests/test-merge1.t @ 27657:7b5c8c8a2f8c

merge: add options to warn or ignore on colliding unknown files A 'colliding unknown file' is a file that meets all of the following conditions: - is untracked or ignored on disk - is present in the changeset being merged or updated to - has different contents Previously, we would always abort whenever we saw such files. With this config option we can choose to warn and back the unknown files up instead, or even forgo the warning entirely and silently back the unknown files up. Common use cases for this configuration include a large scale transition of formerly ignored unknown files to tracked files. In some cases the files can be given new names, but in other cases, external "convention over configuration" constraints have determined that the file must retain the same name as before.
author Siddharth Agarwal <sid0@fb.com>
date Sat, 02 Jan 2016 03:11:52 -0800
parents 6a6e78f84cc6
children 6b639caa1652
line wrap: on
line diff
--- a/tests/test-merge1.t	Sat Jan 02 03:21:01 2016 -0800
+++ b/tests/test-merge1.t	Sat Jan 02 03:11:52 2016 -0800
@@ -124,7 +124,43 @@
   $ echo This is file b2 > b
 #endif
 
-merge of b expected
+bad config
+  $ hg merge 1 --config merge.checkunknown=x
+  abort: merge.checkunknown not valid ('x' is none of 'abort', 'ignore', 'warn')
+  [255]
+this merge should fail
+  $ hg merge 1 --config merge.checkunknown=abort
+  b: untracked file differs
+  abort: untracked files in working directory differ from files in requested revision
+  [255]
+
+this merge should warn
+  $ hg merge 1 --config merge.checkunknown=warn
+  b: replacing untracked file
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ cat b.orig
+  This is file b2
+  $ hg up --clean 2
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ mv b.orig b
+
+this merge should silently ignore
+  $ cat b
+  This is file b2
+  $ hg merge 1 --config merge.checkunknown=ignore
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ cat b.orig
+  This is file b2
+  $ hg up --clean 2
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ mv b.orig b
+
+this merge of b should work
+  $ cat b
+  This is file b2
   $ hg merge -f 1
   merging b
   merging for b