828 tmppath = tempfile.mkdtemp(prefix='upgrade.', dir=repo.path) |
828 tmppath = tempfile.mkdtemp(prefix='upgrade.', dir=repo.path) |
829 backuppath = None |
829 backuppath = None |
830 try: |
830 try: |
831 ui.write(_('creating temporary repository to stage migrated ' |
831 ui.write(_('creating temporary repository to stage migrated ' |
832 'data: %s\n') % tmppath) |
832 'data: %s\n') % tmppath) |
833 dstrepo = localrepo.localrepository(repo.baseui, |
833 |
834 path=tmppath, |
834 # repo.ui is protected against copy: |
835 create=True) |
835 # |
|
836 # running `repo.ui.copy` actually call `repo.baseui.copy`. Here, we |
|
837 # -really- wants to copy the actual `repo.ui` object (since we |
|
838 # create a copy of the repository). |
|
839 # |
|
840 # We have to work around the protection. |
|
841 oldcopy = repo.ui.copy |
|
842 try: |
|
843 repo.ui.__dict__.pop('copy', None) |
|
844 dstrepo = localrepo.localrepository(repo.ui, |
|
845 path=tmppath, |
|
846 create=True) |
|
847 finally: |
|
848 repo.ui.copy = oldcopy |
836 |
849 |
837 with dstrepo.wlock(), dstrepo.lock(): |
850 with dstrepo.wlock(), dstrepo.lock(): |
838 backuppath = _upgraderepo(ui, repo, dstrepo, newreqs, |
851 backuppath = _upgraderepo(ui, repo, dstrepo, newreqs, |
839 upgradeactions) |
852 upgradeactions) |
840 |
853 |