mercurial/upgrade.py
changeset 35342 75520786ad2f
parent 35340 ead01b74be04
child 35343 06987c6971be
--- a/mercurial/upgrade.py	Thu Dec 07 20:50:24 2017 +0100
+++ b/mercurial/upgrade.py	Thu Dec 07 18:55:35 2017 +0100
@@ -830,9 +830,22 @@
         try:
             ui.write(_('creating temporary repository to stage migrated '
                        'data: %s\n') % tmppath)
-            dstrepo = localrepo.localrepository(repo.baseui,
-                                                path=tmppath,
-                                                create=True)
+
+            # 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 = localrepo.localrepository(repo.ui,
+                                                    path=tmppath,
+                                                    create=True)
+            finally:
+                repo.ui.copy = oldcopy
 
             with dstrepo.wlock(), dstrepo.lock():
                 backuppath = _upgraderepo(ui, repo, dstrepo, newreqs,