Windows issue with fork on 1.1.8, Python 2.7.1

Issue #219 resolved
Jason Zavaglia created an issue

An issue with 1.1.8 "fork" on Windows and Python / create_repo_fork() is responsible for an error.

The interaction with the vcs package is as so (this is a replica of the behaviour):

{{{ #!python from vcs import get_backend backend = get_backend('hg') backend('c:\hg_repos\NewRepo', create=True, src_url='c:\hg_repos\OriginalRepo') }}}

The ultimate failure occurs within mercurial / / drop_scheme()

{{{ #!python drop_scheme('file://c:\hg_repos\OriginalRepo') }}} returns ''

{{{ #!python drop_scheme('file://c:/hg_repos/OriginalRepo') }}} returns ''c:/hg_repos/OriginalRepo'

So the issue appears to be with backslashes in the path identifying the repo.

Comments (6)

  1. Jason Zavaglia reporter

    Further to this, I worked out this is not an issue if I configure the repo base location with forward slashes during "paster setup-app production.ini":

    e.g. c:/hg_repos

    Not obvious however, is likely to catch a few people out.

  2. Jason Zavaglia reporter

    I thought about this a little more - I believe the logical source of the error is the moment where file:/// gets prepended to the path.

    i.e. file:///c:\path1\path1 is not a legal file: URI according to

    In my example, it appears the path is c:\hg_repos\NewRepo, at some layer (I guess vcs) that path gets converted to a file URI, file:///c:\hg_repos\NewRepo, and then mercurial tries to strip off the file:/// and convert it back to a path from a URI, but the incorrectly formatted URI causes the problem, and the converted string returned is len() == 0.

    The code which converts the path to a URI should probably do a "proper treatment", and on Windows at least, convert backslashes to slashes, as backlashes are legal grammar in the configuration file (it is a legal path on that o.s.) and this is more resilient.

  3. joberschweiber
    • changed version to 1.2.1

    I get a similar error on tip:

    2011-10-15 10:40:04.940 ERROR [rhodecode.controllers.settings] Traceback (most r
    ecent call last):
      File "D:\src\rhodecode\rhodecode\controllers\", line 192, in fork_c
        repo_model.create_fork(form_result, self.rhodecode_user)
      File "D:\src\rhodecode\rhodecode\model\", line 248, in create_fork
        run_task(tasks.create_repo_fork, form_data, cur_user)
      File "D:\src\rhodecode\rhodecode\lib\celerylib\", line 80, in run_t
        return ResultWrapper(task(*args, **kwargs))
      File "D:\rhodecode-env\lib\site-packages\celery-2.2.7-py2.6.egg\celery\task\ba", line 241, in __call__
        return*args, **kwargs)
      File "D:\rhodecode-env\lib\site-packages\celery-2.2.7-py2.6.egg\celery\app\__i", line 141, in run
        return fun(*args, **kwargs)
      File "D:\src\rhodecode\rhodecode\lib\celerylib\", line 390, in create_
        backend(str(repo_fork_path), create=True, src_url=str(repo_path))
      File "D:\rhodecode-env\lib\site-packages\vcs-0.2.1-py2.6.egg\vcs\backends\hg.p
    y", line 88, in __init__
        self._repo = self._get_repo(create, src_url, update_after_clone)
      File "D:\rhodecode-env\lib\site-packages\vcs-0.2.1-py2.6.egg\vcs\backends\hg.p
    y", line 319, in _get_repo
        raise RepositoryError(msg)
    RepositoryError: Cannot create repository at D:\rhode-root\forkfork. Original er
    ror was file:// URLs can only refer to localhost
    2011-10-15 10:40:05.279 ERROR [rhodecode.model.db] Traceback (most recent call l
      File "D:\src\rhodecode\rhodecode\model\", line 676, in __get_instance
        alias = get_scm(repo_full_path)[0]
      File "D:\rhodecode-env\lib\site-packages\vcs-0.2.1-py2.6.egg\vcs\utils\helpers
    .py", line 32, in get_scm
        raise VCSError("Given path %s is not a directory" % path)
    VCSError: Given path D:\rhode-root\forkfork is not a directory
    2011-10-15 10:40:05.280 ERROR [rhodecode.model.db] Perhaps this repository is in
     db and not in filesystem run rescan repositories with "destroy old data " optio
    n from admin panel
    2011-10-15 10:40:05.282 ERROR [rhodecode.model.scm] forkfork this repository is
    present in database but it cannot be created as an scm instance
  4. Log in to comment