diff mercurial/debugcommands.py @ 35347:bd326f3e0e14

debugformat: update label depending on value difference The new label highlight areas where the repo format differs from current config or default. This should help people spot area where a repository mismatch with the expected state.
author Boris Feld <boris.feld@octobus.net>
date Thu, 07 Dec 2017 16:12:32 +0100
parents cfb403b92f43
children 740d40ec15c3
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Thu Dec 07 16:05:20 2017 +0100
+++ b/mercurial/debugcommands.py	Thu Dec 07 16:12:32 2017 +0100
@@ -891,12 +891,26 @@
         repovalue = fv.fromrepo(repo)
         configvalue = fv.fromconfig(repo)
 
+        if repovalue != configvalue:
+            namelabel = 'formatvariant.name.mismatchconfig'
+            repolabel = 'formatvariant.repo.mismatchconfig'
+        elif repovalue != fv.default:
+            namelabel = 'formatvariant.name.mismatchdefault'
+            repolabel = 'formatvariant.repo.mismatchdefault'
+        else:
+            namelabel = 'formatvariant.name.uptodate'
+            repolabel = 'formatvariant.repo.uptodate'
+
         fm.write('name', makeformatname(fv.name), fv.name,
-                 label='formatvariant.name')
+                 label=namelabel)
         fm.write('repo', ' %3s', formatvalue(repovalue),
-                 label='formatvariant.repo')
+                 label=repolabel)
+        if fv.default != configvalue:
+            configlabel = 'formatvariant.config.special'
+        else:
+            configlabel = 'formatvariant.config.default'
         fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue),
-                     label='formatvariant.config')
+                     label=configlabel)
         fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default),
                      label='formatvariant.default')
         fm.plain('\n')