upgrade: simplify workaround for repo.ui.copy()
Copied from commandserver.py.
--- 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,