phases: more compact error handling in analyzeremotephases
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 05 Apr 2024 11:17:25 +0200
changeset 51578 231a92eb1936
parent 51577 b5d494f7d28a
child 51579 87655e6dc108
phases: more compact error handling in analyzeremotephases using an intermediate variable result in more readable code, so let us use it.
mercurial/phases.py
--- a/mercurial/phases.py	Tue Apr 09 02:54:12 2024 +0200
+++ b/mercurial/phases.py	Fri Apr 05 11:17:25 2024 +0200
@@ -1114,21 +1114,14 @@
         phase = int(phase)
         if phase == public:
             if node != repo.nullid:
-                repo.ui.warn(
-                    _(
-                        b'ignoring inconsistent public root'
-                        b' from remote: %s\n'
-                    )
-                    % nhex
-                )
+                msg = _(b'ignoring inconsistent public root from remote: %s\n')
+                repo.ui.warn(msg % nhex)
         elif phase == draft:
             if has_node(node):
                 draftroots.append(node)
         else:
-            repo.ui.warn(
-                _(b'ignoring unexpected root from remote: %i %s\n')
-                % (phase, nhex)
-            )
+            msg = _(b'ignoring unexpected root from remote: %i %s\n')
+            repo.ui.warn(msg % (phase, nhex))
     # compute heads
     publicheads = newheads(repo, subset, draftroots)
     return publicheads, draftroots