Patchwork D9675: upgrade: remove unnecessary `is None` check

login
register
mail settings
Submitter phabricator
Date Dec. 31, 2020, 4:43 p.m.
Message ID <differential-rev-PHID-DREV-75rc2fmegspnvtfenlpl-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47986/
State Superseded
Headers show

Comments

phabricator - Dec. 31, 2020, 4:43 p.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  `upgrade_engine.upgrade()` always return the `backuppath` value and there are
  not early returns. Hence I don't see how `backuppath` can be None.
  
  Adding extra unncessary safe checks hides unknown bugs. Hence removing it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/upgrade.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -205,7 +205,7 @@ 
                 backuppath = upgrade_engine.upgrade(
                     ui, repo, dstrepo, upgrade_op
                 )
-            if not (backup or backuppath is None):
+            if not backup:
                 ui.status(
                     _(b'removing old repository content %s\n') % backuppath
                 )