diff mercurial/upgrade.py @ 46231:d3113c4cf52c

upgrade: don't perform anything if nothing to do Before this patch, upgrade will process everything, re-clone all revlogs, write requirements file again even there is no change to be made. This patch makes it exit earlier. Differential Revision: https://phab.mercurial-scm.org/D9695
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 08 Jan 2021 23:08:39 +0530
parents e22aed089567
children 0babe12ef35d
line wrap: on
line diff
--- a/mercurial/upgrade.py	Fri Jan 08 23:06:38 2021 +0530
+++ b/mercurial/upgrade.py	Fri Jan 08 23:08:39 2021 +0530
@@ -171,6 +171,9 @@
             upgrade_op.print_unused_optimizations()
         return
 
+    if not (upgrade_op.upgrade_actions or upgrade_op.removed_actions):
+        ui.status(_(b'nothing to do\n'))
+        return
     # Else we're in the run=true case.
     ui.write(_(b'upgrade will perform the following actions:\n\n'))
     upgrade_op.print_requirements()