comparison mercurial/upgrade.py @ 46375:2e8a844d0ae0

upgrade: don't create store backup if `--no-backup` is passed If the user explicitly mentioned that they don't need backup, then let's not create it. Differential Revision: https://phab.mercurial-scm.org/D9770
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 14 Jan 2021 16:25:40 +0530
parents 2eb5fe13461b
children 16c18d5e5dc8
comparison
equal deleted inserted replaced
46374:e92ca942ddca 46375:2e8a844d0ae0
116 newreqs, 116 newreqs,
117 repo.requirements, 117 repo.requirements,
118 up_actions, 118 up_actions,
119 removed_actions, 119 removed_actions,
120 revlogs, 120 revlogs,
121 backup,
121 ) 122 )
122 123
123 if not run: 124 if not run:
124 fromconfig = [] 125 fromconfig = []
125 onlydefault = [] 126 onlydefault = []
213 214
214 with dstrepo.wlock(), dstrepo.lock(): 215 with dstrepo.wlock(), dstrepo.lock():
215 backuppath = upgrade_engine.upgrade( 216 backuppath = upgrade_engine.upgrade(
216 ui, repo, dstrepo, upgrade_op 217 ui, repo, dstrepo, upgrade_op
217 ) 218 )
218 if not backup:
219 ui.status(
220 _(b'removing old repository content %s\n') % backuppath
221 )
222 repo.vfs.rmtree(backuppath, forcibly=True)
223 backuppath = None
224 219
225 finally: 220 finally:
226 ui.status(_(b'removing temporary repository %s\n') % tmppath) 221 ui.status(_(b'removing temporary repository %s\n') % tmppath)
227 repo.vfs.rmtree(tmppath, forcibly=True) 222 repo.vfs.rmtree(tmppath, forcibly=True)
228 223