changeset 49498:f2b1bc19ce90

status: let `--no-copies` override `ui.statuscopies`
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 22 Sep 2022 16:50:30 -0700
parents 1baf0fffd82f
children 4f36738a869a
files mercurial/commands.py tests/test-status.t
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Sep 22 01:50:53 2022 +0200
+++ b/mercurial/commands.py	Thu Sep 22 16:50:30 2022 -0700
@@ -6980,11 +6980,13 @@
     )
 
     copy = {}
-    if (
-        opts.get(b'all')
-        or opts.get(b'copies')
-        or ui.configbool(b'ui', b'statuscopies')
-    ) and not opts.get(b'no_status'):
+    show_copies = ui.configbool(b'ui', b'statuscopies')
+    if opts.get(b'copies') is not None:
+        show_copies = opts.get(b'copies')
+    show_copies = (show_copies or opts.get(b'all')) and not opts.get(
+        b'no_status'
+    )
+    if show_copies:
         copy = copies.pathcopies(ctx1, ctx2, m)
 
     morestatus = None
--- a/tests/test-status.t	Thu Sep 22 01:50:53 2022 +0200
+++ b/tests/test-status.t	Thu Sep 22 16:50:30 2022 -0700
@@ -637,9 +637,16 @@
   M a
     b
   R b
+  $ hg st --config ui.statuscopies=true --no-copies
+  M a
+  R b
   $ hg st --config ui.statuscopies=false
   M a
   R b
+  $ hg st --config ui.statuscopies=false --copies
+  M a
+    b
+  R b
   $ hg st --config ui.tweakdefaults=yes
   M a
     b