# HG changeset patch # User Mads Kiilerich # Date 2013-03-20 14:32:23 # Node ID ca7785fae35441314d8e305f35b1def2a5636e78 # Parent 000653f7cdf9a79e4795b35bef8e22fede563bad avoid %r markup of unicode strings in user facing messages Improves Revision u'b7f4...' does not exist for this repository diff --git a/rhodecode/lib/utils.py b/rhodecode/lib/utils.py --- a/rhodecode/lib/utils.py +++ b/rhodecode/lib/utils.py @@ -768,7 +768,7 @@ def check_git_version(): if 'git' in BACKENDS: log.debug('GIT version detected: %s' % stdout) if stderr: - log.warning('Unable to detect git version org error was:%r' % stderr) + log.warning('Unable to detect git version, org error was: %r' % stderr) elif to_old_git: log.warning('RhodeCode detected git version %s, which is too old ' 'for the system to function properly. Make sure ' diff --git a/rhodecode/lib/vcs/backends/git/changeset.py b/rhodecode/lib/vcs/backends/git/changeset.py --- a/rhodecode/lib/vcs/backends/git/changeset.py +++ b/rhodecode/lib/vcs/backends/git/changeset.py @@ -153,7 +153,7 @@ class GitChangeset(BaseChangeset): self._stat_modes[name] = stat if not path in self._paths: raise NodeDoesNotExistError("There is no file nor directory " - "at the given path %r at revision %r" + "at the given path '%s' at revision %s" % (path, self.short_id)) return self._paths[path] @@ -167,8 +167,8 @@ class GitChangeset(BaseChangeset): def _get_filectx(self, path): path = self._fix_path(path) if self._get_kind(path) != NodeKind.FILE: - raise ChangesetError("File does not exist for revision %r at " - " %r" % (self.raw_id, path)) + raise ChangesetError("File does not exist for revision %s at " + " '%s'" % (self.raw_id, path)) return path def _get_file_nodes(self): @@ -394,8 +394,8 @@ class GitChangeset(BaseChangeset): def get_nodes(self, path): if self._get_kind(path) != NodeKind.DIR: - raise ChangesetError("Directory does not exist for revision %r at " - " %r" % (self.revision, path)) + raise ChangesetError("Directory does not exist for revision %s at " + " '%s'" % (self.revision, path)) path = self._fix_path(path) id = self._get_id_for_path(path) tree = self.repository._repo[id] @@ -458,7 +458,7 @@ class GitChangeset(BaseChangeset): node._blob = obj else: raise NodeDoesNotExistError("There is no file nor directory " - "at the given path %r at revision %r" + "at the given path '%s' at revision %s" % (path, self.short_id)) # cache node self.nodes[path] = node diff --git a/rhodecode/lib/vcs/backends/git/repository.py b/rhodecode/lib/vcs/backends/git/repository.py --- a/rhodecode/lib/vcs/backends/git/repository.py +++ b/rhodecode/lib/vcs/backends/git/repository.py @@ -267,7 +267,7 @@ class GitRepository(BaseRepository): try: revision = self.revisions[int(revision)] except: - raise ChangesetDoesNotExistError("Revision %r does not exist " + raise ChangesetDoesNotExistError("Revision %s does not exist " "for this repository" % (revision)) elif is_bstr(revision): @@ -282,12 +282,12 @@ class GitRepository(BaseRepository): return _tags_shas[_tags_shas.index(revision)] elif not pattern.match(revision) or revision not in self.revisions: - raise ChangesetDoesNotExistError("Revision %r does not exist " + raise ChangesetDoesNotExistError("Revision %s does not exist " "for this repository" % (revision)) # Ensure we return full id if not pattern.match(str(revision)): - raise ChangesetDoesNotExistError("Given revision %r not recognized" + raise ChangesetDoesNotExistError("Given revision %s not recognized" % revision) return revision diff --git a/rhodecode/lib/vcs/backends/hg/changeset.py b/rhodecode/lib/vcs/backends/hg/changeset.py --- a/rhodecode/lib/vcs/backends/hg/changeset.py +++ b/rhodecode/lib/vcs/backends/hg/changeset.py @@ -174,14 +174,14 @@ class MercurialChangeset(BaseChangeset): elif path in self._dir_paths: return NodeKind.DIR else: - raise ChangesetError("Node does not exist at the given path %r" + raise ChangesetError("Node does not exist at the given path '%s'" % (path)) def _get_filectx(self, path): path = self._fix_path(path) if self._get_kind(path) != NodeKind.FILE: - raise ChangesetError("File does not exist for revision %r at " - " %r" % (self.raw_id, path)) + raise ChangesetError("File does not exist for revision %s at " + " '%s'" % (self.raw_id, path)) return self._ctx.filectx(path) def _extract_submodules(self): @@ -300,8 +300,8 @@ class MercurialChangeset(BaseChangeset): """ if self._get_kind(path) != NodeKind.DIR: - raise ChangesetError("Directory does not exist for revision %r at " - " %r" % (self.revision, path)) + raise ChangesetError("Directory does not exist for revision %s at " + " '%s'" % (self.revision, path)) path = self._fix_path(path) filenodes = [FileNode(f, changeset=self) for f in self._file_paths @@ -344,7 +344,7 @@ class MercurialChangeset(BaseChangeset): node = DirNode(path, changeset=self) else: raise NodeDoesNotExistError("There is no file nor directory " - "at the given path: %r at revision %r" + "at the given path: '%s' at revision %s" % (path, self.short_id)) # cache node self.nodes[path] = node diff --git a/rhodecode/lib/vcs/backends/hg/repository.py b/rhodecode/lib/vcs/backends/hg/repository.py --- a/rhodecode/lib/vcs/backends/hg/repository.py +++ b/rhodecode/lib/vcs/backends/hg/repository.py @@ -404,7 +404,7 @@ class MercurialRepository(BaseRepository try: revision = hex(self._repo.lookup(revision)) except (IndexError, ValueError, RepoLookupError, TypeError): - raise ChangesetDoesNotExistError("Revision %r does not " + raise ChangesetDoesNotExistError("Revision %s does not " "exist for this repository" % (revision)) return revision diff --git a/rhodecode/tests/functional/test_files.py b/rhodecode/tests/functional/test_files.py --- a/rhodecode/tests/functional/test_files.py +++ b/rhodecode/tests/functional/test_files.py @@ -291,7 +291,7 @@ removed extra unicode conversion in diff revision=rev, f_path=f_path)) - msg = """Revision %r does not exist for this repository""" % (rev) + msg = """Revision %s does not exist for this repository""" % (rev) self.checkSessionFlash(response, msg) self.assertEqual('http://localhost/%s/files/tip/' % HG_REPO, response.headers['location']) @@ -305,7 +305,7 @@ removed extra unicode conversion in diff revision=rev, f_path=f_path)) - msg = "There is no file nor directory at the given path: %r at revision %r" % (f_path, rev[:12]) + msg = "There is no file nor directory at the given path: '%s' at revision %s" % (f_path, rev[:12]) self.checkSessionFlash(response, msg) #========================================================================== @@ -329,7 +329,7 @@ removed extra unicode conversion in diff repo_name=HG_REPO, revision=rev, f_path=f_path)) - msg = """Revision %r does not exist for this repository""" % (rev) + msg = """Revision %s does not exist for this repository""" % (rev) self.checkSessionFlash(response, msg) self.assertEqual('http://localhost/%s/files/tip/' % HG_REPO, response.headers['location']) @@ -342,7 +342,7 @@ removed extra unicode conversion in diff repo_name=HG_REPO, revision=rev, f_path=f_path)) - msg = "There is no file nor directory at the given path: %r at revision %r" % (f_path, rev[:12]) + msg = "There is no file nor directory at the given path: '%s' at revision %s" % (f_path, rev[:12]) self.checkSessionFlash(response, msg) def test_ajaxed_files_list(self):