Patchwork D5834: commit/revert: if interactive, look elsewhere for whitespace settings (BC)

login
register
mail settings
Submitter phabricator
Date Feb. 5, 2019, 12:12 p.m.
Message ID <183d6118696f43fde2996d951b8b9f10@localhost.localdomain>
Download mbox | patch
Permalink /patch/38427/
State Not Applicable
Headers show

Comments

phabricator - Feb. 5, 2019, 12:12 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG66399f2e92aa: commit: if interactive, look elsewhere for whitespace settings (BC) (authored by spectral, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D5834?vs=13761&id=13804#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5834?vs=13761&id=13804

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/configitems.py
  tests/test-commit-interactive.t
  tests/test-split.t

CHANGE DETAILS




To: spectral, #hg-reviewers
Cc: yuja, mercurial-devel

Patch

diff --git a/tests/test-split.t b/tests/test-split.t
--- a/tests/test-split.t
+++ b/tests/test-split.t
@@ -26,6 +26,8 @@ 
   > [diff]
   > git=1
   > unified=0
+  > [commands]
+  > commit.interactive.unified=0
   > [alias]
   > glog=log -G -T '{rev}:{node|short} {desc} {bookmarks}\n'
   > EOF
@@ -105,10 +107,10 @@ 
 
 This function splits a bit strangely primarily to avoid changing the behavior of
 the test after a bug was fixed with how split/commit --interactive handled
-`diff.unified=0`: when there were no context lines, it kept only the last diff
-hunk. When running split, this meant that runsplit was always recording three commits,
-one for each diff hunk, in reverse order (the base commit was the last diff hunk
-in the file).
+`commands.commit.interactive.unified=0`: when there were no context lines,
+it kept only the last diff hunk. When running split, this meant that runsplit
+was always recording three commits, one for each diff hunk, in reverse order
+(the base commit was the last diff hunk in the file).
   $ runsplit() {
   > cat > $TESTTMP/messages <<EOF
   > split 1
diff --git a/tests/test-commit-interactive.t b/tests/test-commit-interactive.t
--- a/tests/test-commit-interactive.t
+++ b/tests/test-commit-interactive.t
@@ -1808,7 +1808,7 @@ 
   $ hg status -A subdir/f1
   M subdir/f1
 
-Test diff.unified=0
+Test commands.commit.interactive.unified=0
 
   $ hg init $TESTTMP/b
   $ cd $TESTTMP/b
@@ -1829,7 +1829,7 @@ 
   > 4
   > 5
   > EOF
-  $ printf 'y\ny\ny\n' | hg ci -im initial --config diff.unified=0
+  $ printf 'y\ny\ny\n' | hg ci -im initial --config commands.commit.interactive.unified=0
   diff --git a/foo b/foo
   2 hunks, 2 lines changed
   examine changes to 'foo'? [Ynesfdaq?] y
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -201,6 +201,7 @@ 
 coreconfigitem('color', 'pagermode',
     default=dynamicdefault,
 )
+_registerdiffopts(section='commands', configprefix='commit.interactive.')
 coreconfigitem('commands', 'grep.all-files',
     default=False,
 )
@@ -213,6 +214,7 @@ 
 coreconfigitem('commands', 'resolve.mark-check',
     default='none',
 )
+_registerdiffopts(section='commands', configprefix='revert.interactive.')
 coreconfigitem('commands', 'show.aliasprefix',
     default=list,
 )
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -282,7 +282,9 @@ 
         status = repo.status(match=match)
         if not force:
             repo.checkcommitpatterns(wctx, vdirs, match, status, fail)
-        diffopts = patch.difffeatureopts(ui, opts=opts)
+        diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True,
+                                         section='commands',
+                                         configprefix='commit.interactive.')
         diffopts.nodates = True
         diffopts.git = True
         diffopts.showfunc = True
@@ -3126,7 +3128,9 @@ 
         # Prompt the user for changes to revert
         torevert = [f for f in actions['revert'][0] if f not in excluded_files]
         m = scmutil.matchfiles(repo, torevert)
-        diffopts = patch.difffeatureopts(repo.ui)
+        diffopts = patch.difffeatureopts(repo.ui, whitespace=True,
+                                         section='commands',
+                                         configprefix='revert.interactive.')
         diffopts.nodates = True
         diffopts.git = True
         operation = 'discard'