Patchwork D3894: fix: add test case that shows why --whole with --base is useful

login
register
mail settings
Submitter phabricator
Date July 7, 2018, 2:45 a.m.
Message ID <1dcf308d6d4e52ba51fbc56331a1a626@localhost.localdomain>
Download mbox | patch
Permalink /patch/32674/
State Not Applicable
Headers show

Comments

phabricator - July 7, 2018, 2:45 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf068495a1c28: fix: add test case that shows why --whole with --base is useful (authored by hooper, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3894?vs=9465&id=9468

REVISION DETAIL
  https://phab.mercurial-scm.org/D3894

AFFECTED FILES
  hgext/fix.py
  tests/test-fix.t

CHANGE DETAILS




To: hooper, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -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 ..
diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -385,7 +385,9 @@ 
     """Returns a map of the base contexts for each revision
 
     The base contexts determine which lines are considered modified when we
-    attempt to fix just the modified lines in a file.
+    attempt to fix just the modified lines in a file. It also determines which
+    files we attempt to fix, so it is important to compute this even when
+    --whole is used.
     """
     # The --base flag overrides the usual logic, and we give every revision
     # exactly the set of baserevs that the user specified.