Mercurial > hg-stable
changeset 35388:6c28956ba2d4
upgrade: simplify workaround for repo.ui.copy()
Copied from commandserver.py.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 10 Dec 2017 19:43:35 +0900 |
parents | 9144e898cad5 |
children | acff41957b34 |
files | mercurial/upgrade.py |
diffstat | 1 files changed, 3 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/upgrade.py Sun Dec 10 19:41:49 2017 +0900 +++ b/mercurial/upgrade.py Sun Dec 10 19:43:35 2017 +0900 @@ -847,19 +847,9 @@ ui.write(_('creating temporary repository to stage migrated ' 'data: %s\n') % tmppath) - # repo.ui is protected against copy: - # - # running `repo.ui.copy` actually call `repo.baseui.copy`. Here, we - # -really- wants to copy the actual `repo.ui` object (since we - # create a copy of the repository). - # - # We have to work around the protection. - oldcopy = repo.ui.copy - try: - repo.ui.__dict__.pop('copy', None) - dstrepo = hg.repository(repo.ui, path=tmppath, create=True) - finally: - repo.ui.copy = oldcopy + # clone ui without using ui.copy because repo.ui is protected + repoui = repo.ui.__class__(repo.ui) + dstrepo = hg.repository(repoui, path=tmppath, create=True) with dstrepo.wlock(), dstrepo.lock(): backuppath = _upgraderepo(ui, repo, dstrepo, newreqs,