launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #22838
[Merge] lp:~cjwatson/launchpad/git-ref-browse-commits-encoding into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/git-ref-browse-commits-encoding into lp:launchpad.
Commit message:
Fix GitRefContextMenu.browse_commits to cope with non-ASCII ref names.
Requested reviews:
Tom Wardill (twom)
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/git-ref-browse-commits-encoding/+merge/353654
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/git-ref-browse-commits-encoding into lp:launchpad.
=== modified file 'lib/lp/code/browser/gitref.py'
--- lib/lp/code/browser/gitref.py 2018-03-16 21:26:08 +0000
+++ lib/lp/code/browser/gitref.py 2018-08-23 14:59:18 +0000
@@ -84,7 +84,7 @@
text = "All commits"
url = "%s/log/?h=%s" % (
self.context.repository.getCodebrowseUrl(),
- quote_plus(self.context.name))
+ quote_plus(self.context.name.encode("UTF-8")))
return Link(url, text)
def register_merge(self):
=== modified file 'lib/lp/code/browser/tests/test_gitref.py'
--- lib/lp/code/browser/tests/test_gitref.py 2018-08-23 12:34:24 +0000
+++ lib/lp/code/browser/tests/test_gitref.py 2018-08-23 14:59:18 +0000
@@ -252,8 +252,10 @@
[canonical_url(mp)],
[link["href"] for link in details[5].findAll("a")])
- def test_all_commits_link(self):
- [ref] = self.factory.makeGitRefs(paths=["refs/heads/branch"])
+ def _test_all_commits_link(self, branch_name, encoded_branch_name=None):
+ if encoded_branch_name is None:
+ encoded_branch_name = branch_name
+ [ref] = self.factory.makeGitRefs(paths=["refs/heads/%s" % branch_name])
log = self.makeCommitLog()
self.hosting_fixture.getLog.result = list(reversed(log))
self.scanRef(ref, log[-1])
@@ -261,8 +263,8 @@
recent_commits_tag = soupmatchers.Tag(
'recent commits', 'div', attrs={'id': 'recent-commits'})
expected_url = (
- 'https://git.launchpad.dev/%s/log/?h=branch' %
- ref.repository.shortened_path)
+ 'https://git.launchpad.dev/%s/log/?h=%s' %
+ (ref.repository.shortened_path, encoded_branch_name))
self.assertThat(
view(),
soupmatchers.HTMLContains(
@@ -272,6 +274,12 @@
'all commits link', 'a', text='All commits',
attrs={'href': expected_url}))))
+ def test_all_commits_link(self):
+ self._test_all_commits_link("branch")
+
+ def test_all_commits_link_non_ascii(self):
+ self._test_all_commits_link("\N{SNOWMAN}", "%E2%98%83")
+
def test_query_count_landing_candidates(self):
project = self.factory.makeProduct()
[ref] = self.factory.makeGitRefs(target=project)
Follow ups