Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"TypeError: must be str, not unicode" from Mercurial while renaming package #6

Closed
mcepl opened this issue Nov 30, 2013 · 2 comments
Closed

Comments

@mcepl
Copy link
Contributor

mcepl commented Nov 30, 2013

I tried to rename a Python package, and got the following crash from the Mercurial library: presumably from a path being passed as unicode somewhere, instead of str.

I'm not certain whether this is a Rope issue, or a Mercurial library issue: if it turns out to be the latter, i'll take the issue upstream.

Versions:

  • Python 2.7.4
  • Vim 7.3 (patches 1-547)
  • python-mode 0.6.18
  • ropemode 0.2
  • rope 0.9.4
  • Mercurial 2.6.1

Traceback:

      Error detected while processing function RopeRename:
    line    1:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "[...]/ropemode/decorators.py", line 53, in newfunc
        return func(*args, **kwds)
      File "[...]/ropemode/interface.py", line 49, in do_refactor
        refactoring(self, self.env).show(initial_asking=initial_asking)
      File "[...]/ropemode/refactor.py", line 45, in show
        self._perform(changes)
      File "[...]/ropemode/refactor.py", line 94, in _perform
        interrupts=False)
      File "[...]/ropemode/refactor.py", line 472, in runtask
        return RunTask(env, command, name, interrupts)()
      File "[...]/ropemode/refactor.py", line 492, in __call__
        result = self.task(handle)
      File "[...]/ropemode/refactor.py", line 90, in perform
        self.project.do(changes, task_handle=handle)
      File "[...]/rope/base/project.py", line 72, in do
        self.history.do(changes, task_handle=task_handle)
      File "[...]/rope/base/history.py", line 36, in do
        changes.do(change.create_job_set(task_handle, changes))
      File "[...]/rope/base/change.py", line 66, in do
        change.do(job_set)
      File "[...]/rope/base/change.py", line 126, in call
        function(self)
      File "[...]/rope/base/change.py", line 201, in do
        self._operations.move(self.resource, self.new_resource)
      File "[...]/rope/base/change.py", line 337, in move
        fscommands.move(resource.real_path, new_resource.real_path)
      File "[...]/rope/base/fscommands.py", line 115, in move
        new_location, after=False)
      File "/usr/lib/python2.7/dist-packages/mercurial/commands.py", line 4808, in rename
        return cmdutil.copy(ui, repo, pats, opts, rename=True)
      File "/usr/lib/python2.7/dist-packages/mercurial/cmdutil.py", line 459, in copy
        if copyfile(abssrc, relsrc, targetpath(abssrc), exact):
      File "/usr/lib/python2.7/dist-packages/mercurial/cmdutil.py", line 357, in copyfile
        dryrun=dryrun, cwd=cwd)
      File "/usr/lib/python2.7/dist-packages/mercurial/scmutil.py", line 764, in dirstatecopy
        wctx.copy(origsrc, dst)
      File "/usr/lib/python2.7/dist-packages/mercurial/context.py", line 1135, in copy
        self._repo.dirstate.add(dest)
      File "/usr/lib/python2.7/dist-packages/mercurial/dirstate.py", line 384, in add
        self._addpath(f, 'a', 0, -1, -1)
      File "/usr/lib/python2.7/dist-packages/mercurial/dirstate.py", line 333, in _addpath
        self._dirs.addpath(f)
    TypeError: must be str, not unicode
@mcepl
Copy link
Contributor Author

mcepl commented Nov 30, 2013

I think the proper fix is changing MercurialCommands in fscommands.py
to use mercurial's command-line interface instead of its API, just like
GITCommands.

Ali

@lucomsky
Copy link

@mcepl, is this bug still exists on Python 3+?

@mcepl mcepl closed this as completed Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants