diff tests/test-fix.t @ 38590:f068495a1c28

fix: add test case that shows why --whole with --base is useful Differential Revision: https://phab.mercurial-scm.org/D3894
author Danny Hooper <hooper@google.com>
date Fri, 06 Jul 2018 12:47:02 -0700
parents 80695628adcb
children a009589cd32a
line wrap: on
line diff
--- a/tests/test-fix.t	Fri Jul 06 16:45:44 2018 -0700
+++ b/tests/test-fix.t	Fri Jul 06 12:47:02 2018 -0700
@@ -1027,3 +1027,29 @@
 
   $ cd ..
 
+The --base flag affects the set of files being fixed. So while the --whole flag
+makes the base irrelevant for changed line ranges, it still changes the
+meaning and effect of the command. In this example, no files or lines are fixed
+until we specify the base, but then we do fix unchanged lines.
+
+  $ hg init basewhole
+  $ cd basewhole
+  $ printf "foo1\n" > foo.changed
+  $ hg commit -Aqm "first"
+  $ printf "foo2\n" >> foo.changed
+  $ printf "bar\n" > bar.changed
+  $ hg commit -Aqm "second"
+
+  $ hg fix --working-dir --whole
+  $ cat *.changed
+  bar
+  foo1
+  foo2
+
+  $ hg fix --working-dir --base 0 --whole
+  $ cat *.changed
+  BAR
+  FOO1
+  FOO2
+
+  $ cd ..