changeset 4362:79eb3211cda1

compare: links from file list to file diff should just use anchor
author Mads Kiilerich <madski@unity3d.com>
date Fri, 18 Jul 2014 19:21:56 +0200
parents 348ecbd25577
children 7ad20e8f16bd
files kallithea/templates/compare/compare_diff.html kallithea/templates/pullrequests/pullrequest_show.html kallithea/tests/functional/test_compare.py kallithea/tests/functional/test_compare_local.py
diffstat 4 files changed, 36 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/templates/compare/compare_diff.html	Fri Jul 18 18:47:02 2014 +0200
+++ b/kallithea/templates/compare/compare_diff.html	Fri Jul 18 19:21:56 2014 +0200
@@ -69,7 +69,7 @@
                   %endif
                   %for fid, change, f, stat in c.files:
                       <div class="cs_${change}">
-                        <div class="node">${h.link_to(h.safe_unicode(f),h.url.current(anchor=fid, **request.GET.mixed()))}</div>
+                        <div class="node">${h.link_to(h.safe_unicode(f), '#' + fid)}</div>
                         <div class="changes">${h.fancy_file_stats(stat)}</div>
                       </div>
                   %endfor
--- a/kallithea/templates/pullrequests/pullrequest_show.html	Fri Jul 18 18:47:02 2014 +0200
+++ b/kallithea/templates/pullrequests/pullrequest_show.html	Fri Jul 18 19:21:56 2014 +0200
@@ -250,7 +250,7 @@
                 %endif
                 %for fid, change, f, stat in c.files:
                     <div class="cs_${change}">
-                      <div class="node">${h.link_to(h.safe_unicode(f),h.url.current(anchor=fid))}</div>
+                      <div class="node">${h.link_to(h.safe_unicode(f),'#' + fid)}</div>
                       <div class="changes">${h.fancy_file_stats(stat)}</div>
                     </div>
                 %endfor
--- a/kallithea/tests/functional/test_compare.py	Fri Jul 18 18:47:02 2014 +0200
+++ b/kallithea/tests/functional/test_compare.py	Fri Jul 18 19:21:56 2014 +0200
@@ -103,7 +103,7 @@
         response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
         response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
         ## files
-        response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=1#C--826e8142e6ba">file1</a>""" % (repo1.repo_name, rev2, rev1, repo2.repo_name))
+        response.mustcontain("""<a href="#C--826e8142e6ba">file1</a>""")
         #swap
         response.mustcontain("""<a class="btn btn-small" href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True"><i class="icon-refresh"></i> Swap</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
 
@@ -151,7 +151,7 @@
         response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
         response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
         ## files
-        response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=1#C--826e8142e6ba">file1</a>""" % (repo1.repo_name, rev2, rev1, repo2.repo_name))
+        response.mustcontain("""<a href="#C--826e8142e6ba">file1</a>""")
         #swap
         response.mustcontain("""<a class="btn btn-small" href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True"><i class="icon-refresh"></i> Swap</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
 
@@ -206,7 +206,7 @@
         response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
         response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
         ## files
-        response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=1#C--826e8142e6ba">file1</a>""" % (repo1.repo_name, rev2, rev1, repo2.repo_name))
+        response.mustcontain("""<a href="#C--826e8142e6ba">file1</a>""")
         #swap
         response.mustcontain("""<a class="btn btn-small" href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True"><i class="icon-refresh"></i> Swap</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
 
@@ -261,7 +261,7 @@
         response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
         response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
         ## files
-        response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=1#C--826e8142e6ba">file1</a>""" % (repo1.repo_name, rev2, rev1, repo2.repo_name))
+        response.mustcontain("""<a href="#C--826e8142e6ba">file1</a>""")
         #swap
         response.mustcontain("""<a class="btn btn-small" href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True"><i class="icon-refresh"></i> Swap</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
 
@@ -419,9 +419,9 @@
         response.mustcontain("""<a href="/%s/changeset/7d4bc8ec6be56c0f10425afb40b6fc315a4c25e7">r6:%s</a>""" % (HG_FORK, rev2))
 
         ## files
-        response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s?other_repo=%s&amp;merge=1#C--9c390eb52cd6">vcs/backends/hg.py</a>""" % (HG_REPO, rev1, rev2, HG_FORK))
-        response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s?other_repo=%s&amp;merge=1#C--41b41c1f2796">vcs/backends/__init__.py</a>""" % (HG_REPO, rev1, rev2, HG_FORK))
-        response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s?other_repo=%s&amp;merge=1#C--2f574d260608">vcs/backends/base.py</a>""" % (HG_REPO, rev1, rev2, HG_FORK))
+        response.mustcontain("""<a href="#C--9c390eb52cd6">vcs/backends/hg.py</a>""")
+        response.mustcontain("""<a href="#C--41b41c1f2796">vcs/backends/__init__.py</a>""")
+        response.mustcontain("""<a href="#C--2f574d260608">vcs/backends/base.py</a>""")
 
     def test_compare_remote_branches_git(self):
         self.log_user()
@@ -449,9 +449,9 @@
         response.mustcontain("""<a href="/%s/changeset/d7e0d30fbcae12c90680eb095a4f5f02505ce501">r6:%s</a>""" % (GIT_FORK, rev2[:12]))
 
         ## files
-        response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s?other_repo=%s&amp;merge=1#C--9c390eb52cd6">vcs/backends/hg.py</a>""" % (GIT_REPO, rev1, rev2, GIT_FORK))
-        response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s?other_repo=%s&amp;merge=1#C--41b41c1f2796">vcs/backends/__init__.py</a>""" % (GIT_REPO, rev1, rev2, GIT_FORK))
-        response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s?other_repo=%s&amp;merge=1#C--2f574d260608">vcs/backends/base.py</a>""" % (GIT_REPO, rev1, rev2, GIT_FORK))
+        response.mustcontain("""<a href="#C--9c390eb52cd6">vcs/backends/hg.py</a>""")
+        response.mustcontain("""<a href="#C--41b41c1f2796">vcs/backends/__init__.py</a>""")
+        response.mustcontain("""<a href="#C--2f574d260608">vcs/backends/base.py</a>""")
 
     def test_org_repo_new_commits_after_forking_simple_diff_hg(self):
         self.log_user()
--- a/kallithea/tests/functional/test_compare_local.py	Fri Jul 18 18:47:02 2014 +0200
+++ b/kallithea/tests/functional/test_compare_local.py	Fri Jul 18 19:21:56 2014 +0200
@@ -29,17 +29,17 @@
         response.mustcontain('11 files changed with 94 insertions and 64 deletions')
 
         ## files diff
-        response.mustcontain('''<div class="node"><a href="/%s/compare/tag@%s...tag@%s#C--1c5cf9e91c12">docs/api/utils/index.rst</a></div>''' % (HG_REPO, tag1, tag2))
-        response.mustcontain('''<div class="node"><a href="/%s/compare/tag@%s...tag@%s#C--e3305437df55">test_and_report.sh</a></div>''' % (HG_REPO, tag1, tag2))
-        response.mustcontain('''<div class="node"><a href="/%s/compare/tag@%s...tag@%s#C--c8e92ef85cd1">.hgignore</a></div>''' % (HG_REPO, tag1, tag2))
-        response.mustcontain('''<div class="node"><a href="/%s/compare/tag@%s...tag@%s#C--6e08b694d687">.hgtags</a></div>''' % (HG_REPO, tag1, tag2))
-        response.mustcontain('''<div class="node"><a href="/%s/compare/tag@%s...tag@%s#C--2c14b00f3393">docs/api/index.rst</a></div>''' % (HG_REPO, tag1, tag2))
-        response.mustcontain('''<div class="node"><a href="/%s/compare/tag@%s...tag@%s#C--430ccbc82bdf">vcs/__init__.py</a></div>''' % (HG_REPO, tag1, tag2))
-        response.mustcontain('''<div class="node"><a href="/%s/compare/tag@%s...tag@%s#C--9c390eb52cd6">vcs/backends/hg.py</a></div>''' % (HG_REPO, tag1, tag2))
-        response.mustcontain('''<div class="node"><a href="/%s/compare/tag@%s...tag@%s#C--ebb592c595c0">vcs/utils/__init__.py</a></div>''' % (HG_REPO, tag1, tag2))
-        response.mustcontain('''<div class="node"><a href="/%s/compare/tag@%s...tag@%s#C--7abc741b5052">vcs/utils/annotate.py</a></div>''' % (HG_REPO, tag1, tag2))
-        response.mustcontain('''<div class="node"><a href="/%s/compare/tag@%s...tag@%s#C--2ef0ef106c56">vcs/utils/diffs.py</a></div>''' % (HG_REPO, tag1, tag2))
-        response.mustcontain('''<div class="node"><a href="/%s/compare/tag@%s...tag@%s#C--3150cb87d4b7">vcs/utils/lazy.py</a></div>''' % (HG_REPO, tag1, tag2))
+        response.mustcontain('''<div class="node"><a href="#C--1c5cf9e91c12">docs/api/utils/index.rst</a></div>''')
+        response.mustcontain('''<div class="node"><a href="#C--e3305437df55">test_and_report.sh</a></div>''')
+        response.mustcontain('''<div class="node"><a href="#C--c8e92ef85cd1">.hgignore</a></div>''')
+        response.mustcontain('''<div class="node"><a href="#C--6e08b694d687">.hgtags</a></div>''')
+        response.mustcontain('''<div class="node"><a href="#C--2c14b00f3393">docs/api/index.rst</a></div>''')
+        response.mustcontain('''<div class="node"><a href="#C--430ccbc82bdf">vcs/__init__.py</a></div>''')
+        response.mustcontain('''<div class="node"><a href="#C--9c390eb52cd6">vcs/backends/hg.py</a></div>''')
+        response.mustcontain('''<div class="node"><a href="#C--ebb592c595c0">vcs/utils/__init__.py</a></div>''')
+        response.mustcontain('''<div class="node"><a href="#C--7abc741b5052">vcs/utils/annotate.py</a></div>''')
+        response.mustcontain('''<div class="node"><a href="#C--2ef0ef106c56">vcs/utils/diffs.py</a></div>''')
+        response.mustcontain('''<div class="node"><a href="#C--3150cb87d4b7">vcs/utils/lazy.py</a></div>''')
 
     def test_compare_tag_git(self):
         self.log_user()
@@ -67,17 +67,17 @@
         response.mustcontain('11 files changed with 94 insertions and 64 deletions')
 
         #files
-        response.mustcontain('''<a href="/%s/compare/tag@%s...tag@%s#C--1c5cf9e91c12">docs/api/utils/index.rst</a>''' % (GIT_REPO, tag1, tag2))
-        response.mustcontain('''<a href="/%s/compare/tag@%s...tag@%s#C--e3305437df55">test_and_report.sh</a>''' % (GIT_REPO, tag1, tag2))
-        response.mustcontain('''<a href="/%s/compare/tag@%s...tag@%s#C--c8e92ef85cd1">.hgignore</a>''' % (GIT_REPO, tag1, tag2))
-        response.mustcontain('''<a href="/%s/compare/tag@%s...tag@%s#C--6e08b694d687">.hgtags</a>''' % (GIT_REPO, tag1, tag2))
-        response.mustcontain('''<a href="/%s/compare/tag@%s...tag@%s#C--2c14b00f3393">docs/api/index.rst</a>''' % (GIT_REPO, tag1, tag2))
-        response.mustcontain('''<a href="/%s/compare/tag@%s...tag@%s#C--430ccbc82bdf">vcs/__init__.py</a>''' % (GIT_REPO, tag1, tag2))
-        response.mustcontain('''<a href="/%s/compare/tag@%s...tag@%s#C--9c390eb52cd6">vcs/backends/hg.py</a>''' % (GIT_REPO, tag1, tag2))
-        response.mustcontain('''<a href="/%s/compare/tag@%s...tag@%s#C--ebb592c595c0">vcs/utils/__init__.py</a>''' % (GIT_REPO, tag1, tag2))
-        response.mustcontain('''<a href="/%s/compare/tag@%s...tag@%s#C--7abc741b5052">vcs/utils/annotate.py</a>''' % (GIT_REPO, tag1, tag2))
-        response.mustcontain('''<a href="/%s/compare/tag@%s...tag@%s#C--2ef0ef106c56">vcs/utils/diffs.py</a>''' % (GIT_REPO, tag1, tag2))
-        response.mustcontain('''<a href="/%s/compare/tag@%s...tag@%s#C--3150cb87d4b7">vcs/utils/lazy.py</a>''' % (GIT_REPO, tag1, tag2))
+        response.mustcontain('''<a href="#C--1c5cf9e91c12">docs/api/utils/index.rst</a>''')
+        response.mustcontain('''<a href="#C--e3305437df55">test_and_report.sh</a>''')
+        response.mustcontain('''<a href="#C--c8e92ef85cd1">.hgignore</a>''')
+        response.mustcontain('''<a href="#C--6e08b694d687">.hgtags</a>''')
+        response.mustcontain('''<a href="#C--2c14b00f3393">docs/api/index.rst</a>''')
+        response.mustcontain('''<a href="#C--430ccbc82bdf">vcs/__init__.py</a>''')
+        response.mustcontain('''<a href="#C--9c390eb52cd6">vcs/backends/hg.py</a>''')
+        response.mustcontain('''<a href="#C--ebb592c595c0">vcs/utils/__init__.py</a>''')
+        response.mustcontain('''<a href="#C--7abc741b5052">vcs/utils/annotate.py</a>''')
+        response.mustcontain('''<a href="#C--2ef0ef106c56">vcs/utils/diffs.py</a>''')
+        response.mustcontain('''<a href="#C--3150cb87d4b7">vcs/utils/lazy.py</a>''')
 
     def test_index_branch_hg(self):
         self.log_user()
@@ -131,7 +131,7 @@
 
         response.mustcontain('1 file changed with 7 insertions and 0 deletions')
         ## files
-        response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--c8e92ef85cd1">.hgignore</a>""" % (HG_REPO, rev1, rev2))
+        response.mustcontain("""<a href="#C--c8e92ef85cd1">.hgignore</a>""")
 
     def test_compare_revisions_git(self):
         self.log_user()
@@ -153,4 +153,4 @@
         response.mustcontain('1 file changed with 7 insertions and 0 deletions')
 
         ## files
-        response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--c8e92ef85cd1">.hgignore</a>""" % (GIT_REPO, rev1, rev2))
+        response.mustcontain("""<a href="#C--c8e92ef85cd1">.hgignore</a>""")