changeset 4291:c2e3923eebe4

compare: consistent naming: _ref is a tuple, _ref_type is the type, _ref_name is symbolic name, _rev is the revision
author Mads Kiilerich <madski@unity3d.com>
date Fri, 28 Jun 2013 11:50:13 +0200
parents 35be05089010
children 60ea826baf09
files kallithea/config/routing.py kallithea/controllers/compare.py kallithea/controllers/pullrequests.py kallithea/templates/base/base.html kallithea/templates/bookmarks/bookmarks.html kallithea/templates/branches/branches.html kallithea/templates/changelog/changelog.html kallithea/templates/changeset/changeset_range.html kallithea/templates/changeset/diff_block.html kallithea/templates/compare/compare_diff.html kallithea/templates/forks/forks_data.html kallithea/templates/pullrequests/pullrequest.html kallithea/templates/pullrequests/pullrequest_show.html kallithea/templates/tags/tags.html kallithea/tests/functional/test_compare.py kallithea/tests/functional/test_compare_local.py
diffstat 16 files changed, 97 insertions(+), 111 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/config/routing.py	Fri Jun 28 02:26:13 2013 +0200
+++ b/kallithea/config/routing.py	Fri Jun 28 11:50:13 2013 +0200
@@ -675,7 +675,7 @@
                  conditions=dict(function=check_repo))
 
     rmap.connect('compare_url',
-                 '/{repo_name:.*?}/compare/{org_ref_type}@{org_ref:.*?}...{other_ref_type}@{other_ref:.*?}',
+                 '/{repo_name:.*?}/compare/{org_ref_type}@{org_ref_name:.*?}...{other_ref_type}@{other_ref_name:.*?}',
                  controller='compare', action='compare',
                  conditions=dict(function=check_repo),
                  requirements=dict(
--- a/kallithea/controllers/compare.py	Fri Jun 28 02:26:13 2013 +0200
+++ b/kallithea/controllers/compare.py	Fri Jun 28 11:50:13 2013 +0200
@@ -191,18 +191,18 @@
         other_repo = request.GET.get('other_repo', org_repo)
         c.org_repo = Repository.get_by_repo_name(org_repo)
         c.other_repo = Repository.get_by_repo_name(other_repo)
-        c.org_ref = c.other_ref = _('Select changeset')
+        c.org_ref_name = c.other_ref_name = _('Select changeset')
         return render('compare/compare_diff.html')
 
     @LoginRequired()
     @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
                                    'repository.admin')
-    def compare(self, repo_name, org_ref_type, org_ref, other_ref_type, other_ref):
+    def compare(self, repo_name, org_ref_type, org_ref_name, other_ref_type, other_ref_name):
         # org_ref will be evaluated in org_repo
         org_repo = c.db_repo.repo_name
-        org_ref = (org_ref_type, org_ref)
+        org_ref = (org_ref_type, org_ref_name)
         # other_ref will be evaluated in other_repo
-        other_ref = (other_ref_type, other_ref)
+        other_ref = (other_ref_type, other_ref_name)
         other_repo = request.GET.get('other_repo', org_repo)
         # If merge is True:
         #   Show what org would get if merged with other:
@@ -222,9 +222,9 @@
         # swap url for compare_diff page - never partial and never as_form
         c.swap_url = h.url('compare_url',
             repo_name=other_repo,
-            org_ref_type=other_ref[0], org_ref=other_ref[1],
+            org_ref_type=other_ref_type, org_ref_name=other_ref_name,
             other_repo=org_repo,
-            other_ref_type=org_ref[0], other_ref=org_ref[1],
+            other_ref_type=org_ref_type, other_ref_name=org_ref_name,
             merge=merge or '')
 
         org_repo = Repository.get_by_repo_name(org_repo)
@@ -248,20 +248,20 @@
             h.flash(msg, category='error')
             return redirect(url('compare_home', repo_name=c.repo_name))
 
-        org_rev = self.__get_rev_or_redirect(ref=org_ref, repo=org_repo, partial=partial)
-        other_rev = self.__get_rev_or_redirect(ref=other_ref, repo=other_repo, partial=partial)
+        c.org_rev = self.__get_rev_or_redirect(ref=org_ref, repo=org_repo, partial=partial)
+        c.other_rev = self.__get_rev_or_redirect(ref=other_ref, repo=other_repo, partial=partial)
 
         c.compare_home = False
         c.org_repo = org_repo
         c.other_repo = other_repo
-        c.org_ref = org_ref[1]
-        c.other_ref = other_ref[1]
-        c.org_ref_type = org_ref[0]
-        c.other_ref_type = other_ref[0]
+        c.org_ref_name = org_ref_name
+        c.other_ref_name = other_ref_name
+        c.org_ref_type = org_ref_type
+        c.other_ref_type = other_ref_type
 
         c.cs_ranges, c.ancestor = self._get_changesets(
-            org_repo.scm_instance.alias, org_repo.scm_instance, org_rev,
-            other_repo.scm_instance, other_rev, merge)
+            org_repo.scm_instance.alias, org_repo.scm_instance, c.org_rev,
+            other_repo.scm_instance, c.other_rev, merge)
         c.statuses = c.db_repo.statuses(
             [x.raw_id for x in c.cs_ranges])
 
@@ -274,18 +274,20 @@
             assert merge
             # case we want a simple diff without incoming changesets,
             # previewing what will be merged.
-            # Make the diff on the other repo (which is known to have other_ref)
-            log.debug('Using ancestor %s as org_ref instead of %s'
-                      % (c.ancestor, org_ref))
-            org_rev = c.ancestor
+            # Make the diff on the other repo (which is known to have other_rev)
+            log.debug('Using ancestor %s as rev1 instead of %s'
+                      % (c.ancestor, c.org_rev))
+            rev1 = c.ancestor
             org_repo = other_repo
+        else: # comparing tips, not necessarily linearly related
+            rev1 = c.org_rev
 
         diff_limit = self.cut_off_limit if not c.fulldiff else None
 
         log.debug('running diff between %s and %s in %s'
-                  % (org_rev, other_rev, org_repo.scm_instance.path))
+                  % (rev1, c.other_rev, org_repo.scm_instance.path))
+        txtdiff = org_repo.scm_instance.get_diff(rev1=rev1, rev2=c.other_rev)
 
-        txtdiff = org_repo.scm_instance.get_diff(rev1=org_rev, rev2=other_rev)
         diff_processor = diffs.DiffProcessor(txtdiff or '', format='gitdiff',
                                              diff_limit=diff_limit)
         _parsed = diff_processor.prepare()
--- a/kallithea/controllers/pullrequests.py	Fri Jun 28 02:26:13 2013 +0200
+++ b/kallithea/controllers/pullrequests.py	Fri Jun 28 11:50:13 2013 +0200
@@ -179,41 +179,27 @@
 
         :param pull_request:
         """
-        org_repo = pull_request.org_repo
-        (org_ref_type,
-         org_ref_name,
-         org_ref_rev) = pull_request.org_ref.split(':')
-
-        other_repo = org_repo
-        (other_ref_type,
-         other_ref_name,
-         other_ref_rev) = pull_request.other_ref.split(':')
-
-        # despite opening revisions for bookmarks/branches/tags, we always
-        # convert this to rev to prevent changes after bookmark or branch change
-        org_ref = ('rev', org_ref_rev)
-        other_ref = ('rev', other_ref_rev)
+        c.org_repo = pull_request.org_repo
+        (c.org_ref_type,
+         c.org_ref_name,
+         c.org_rev) = pull_request.org_ref.split(':')
 
-        c.org_repo = org_repo
-        c.other_repo = other_repo
-
-        c.fulldiff = fulldiff = request.GET.get('fulldiff')
-
-        c.cs_ranges = [org_repo.get_changeset(x) for x in pull_request.revisions]
+        c.other_repo = c.org_repo
+        (c.other_ref_type,
+         c.other_ref_name,
+         c.other_rev) = pull_request.other_ref.split(':')
 
-        c.statuses = org_repo.statuses([x.raw_id for x in c.cs_ranges])
+        c.cs_ranges = [c.org_repo.get_changeset(x) for x in pull_request.revisions]
 
-        c.org_ref = org_ref[1]
-        c.org_ref_type = org_ref[0]
-        c.other_ref = other_ref[1]
-        c.other_ref_type = other_ref[0]
+        c.statuses = c.org_repo.statuses([x.raw_id for x in c.cs_ranges])
 
-        diff_limit = self.cut_off_limit if not fulldiff else None
+        c.fulldiff = request.GET.get('fulldiff')
+        diff_limit = self.cut_off_limit if not c.fulldiff else None
 
         # we swap org/other ref since we run a simple diff on one repo
         log.debug('running diff between %s and %s in %s'
-                  % (other_ref, org_ref, org_repo.scm_instance.path))
-        txtdiff = org_repo.scm_instance.get_diff(rev1=safe_str(other_ref[1]), rev2=safe_str(org_ref[1]))
+                  % (c.other_rev, c.org_rev, c.org_repo.scm_instance.path))
+        txtdiff = c.org_repo.scm_instance.get_diff(rev1=safe_str(c.other_rev), rev2=safe_str(c.org_rev))
 
         diff_processor = diffs.DiffProcessor(txtdiff or '', format='gitdiff',
                                              diff_limit=diff_limit)
--- a/kallithea/templates/base/base.html	Fri Jun 28 02:26:13 2013 +0200
+++ b/kallithea/templates/base/base.html	Fri Jun 28 11:50:13 2013 +0200
@@ -167,7 +167,7 @@
                    <li><a href="${h.url('edit_repo',repo_name=c.repo_name)}"><i class="icon-cog"></i> ${_('Settings')}</a></li>
              %endif
               %if c.db_repo.fork:
-               <li><a href="${h.url('compare_url',repo_name=c.db_repo.fork.repo_name,org_ref_type=c.db_repo.landing_rev[0],org_ref=c.db_repo.landing_rev[1], other_repo=c.repo_name,other_ref_type='branch' if request.GET.get('branch') else c.db_repo.landing_rev[0],other_ref=request.GET.get('branch') or c.db_repo.landing_rev[1], merge=1)}">
+               <li><a href="${h.url('compare_url',repo_name=c.db_repo.fork.repo_name,org_ref_type=c.db_repo.landing_rev[0],org_ref_name=c.db_repo.landing_rev[1], other_repo=c.repo_name,other_ref_type='branch' if request.GET.get('branch') else c.db_repo.landing_rev[0],other_ref_name=request.GET.get('branch') or c.db_repo.landing_rev[1], merge=1)}">
                    <i class="icon-loop"></i> ${_('Compare fork')}</a></li>
               %endif
               <li><a href="${h.url('compare_home',repo_name=c.repo_name)}"><i class="icon-loop"></i> ${_('Compare')}</a></li>
--- a/kallithea/templates/bookmarks/bookmarks.html	Fri Jun 28 02:26:13 2013 +0200
+++ b/kallithea/templates/bookmarks/bookmarks.html	Fri Jun 28 11:50:13 2013 +0200
@@ -40,7 +40,7 @@
     var other = YUQ('input[name=compare_other]:checked')[0];
 
     if(org && other){
-        var compare_url = "${h.url('compare_url',repo_name=c.repo_name,org_ref_type='book',org_ref='__ORG__',other_ref_type='book',other_ref='__OTHER__')}";
+        var compare_url = "${h.url('compare_url',repo_name=c.repo_name,org_ref_type='book',org_ref_name='__ORG__',other_ref_type='book',other_ref_name='__OTHER__')}";
         var u = compare_url.replace('__ORG__',org.value)
                            .replace('__OTHER__',other.value);
         window.location=u;
--- a/kallithea/templates/branches/branches.html	Fri Jun 28 02:26:13 2013 +0200
+++ b/kallithea/templates/branches/branches.html	Fri Jun 28 11:50:13 2013 +0200
@@ -39,7 +39,7 @@
     var other = YUQ('input[name=compare_other]:checked')[0];
 
     if(org && other){
-        var compare_url = "${h.url('compare_url',repo_name=c.repo_name,org_ref_type='branch',org_ref='__ORG__',other_ref_type='branch',other_ref='__OTHER__')}";
+        var compare_url = "${h.url('compare_url',repo_name=c.repo_name,org_ref_type='branch',org_ref_name='__ORG__',other_ref_type='branch',other_ref_name='__OTHER__')}";
         var u = compare_url.replace('__ORG__',org.value)
                            .replace('__OTHER__',other.value);
         window.location=u;
--- a/kallithea/templates/changelog/changelog.html	Fri Jun 28 02:26:13 2013 +0200
+++ b/kallithea/templates/changelog/changelog.html	Fri Jun 28 11:50:13 2013 +0200
@@ -52,7 +52,7 @@
                             %if c.db_repo.fork:
                                 <a id="compare_fork"
                                    title="${_('Compare fork with %s' % c.db_repo.fork.repo_name)}"
-                                   href="${h.url('compare_url',repo_name=c.db_repo.fork.repo_name,org_ref_type=c.db_repo.landing_rev[0],org_ref=c.db_repo.landing_rev[1],other_repo=c.repo_name,other_ref_type='branch' if request.GET.get('branch') else c.db_repo.landing_rev[0],other_ref=request.GET.get('branch') or c.db_repo.landing_rev[1], merge=1)}"
+                                   href="${h.url('compare_url',repo_name=c.db_repo.fork.repo_name,org_ref_type=c.db_repo.landing_rev[0],org_ref_name=c.db_repo.landing_rev[1],other_repo=c.repo_name,other_ref_type='branch' if request.GET.get('branch') else c.db_repo.landing_rev[0],other_ref_name=request.GET.get('branch') or c.db_repo.landing_rev[1], merge=1)}"
                                    class="btn btn-mini"><i class="icon-loop"></i> ${_('Compare fork with parent repo (%s)' % c.db_repo.fork.repo_name)}</a>
                             %endif
                             ## text and href of open_new_pr is controlled from javascript
--- a/kallithea/templates/changeset/changeset_range.html	Fri Jun 28 02:26:13 2013 +0200
+++ b/kallithea/templates/changeset/changeset_range.html	Fri Jun 28 11:50:13 2013 +0200
@@ -33,7 +33,7 @@
                     r${c.cs_ranges[0].revision}:${h.short_id(c.cs_ranges[0].raw_id)}
                     <i class="icon-arrow-right"></i>
                     r${c.cs_ranges[-1].revision}:${h.short_id(c.cs_ranges[-1].raw_id)}
-                    <a style="font-weight: bold" href="${h.url('compare_url',repo_name=c.repo_name,org_ref_type='rev',org_ref=getattr(c.cs_ranges[0].parents[0] if c.cs_ranges[0].parents else h.EmptyChangeset(),'raw_id'),other_ref_type='rev',other_ref=c.cs_ranges[-1].raw_id)}" class="btn btn-small"><i class="icon-loop"></i> Compare Revisions</a>
+                    <a style="font-weight: bold" href="${h.url('compare_url',repo_name=c.repo_name,org_ref_type='rev',org_ref_name=getattr(c.cs_ranges[0].parents[0] if c.cs_ranges[0].parents else h.EmptyChangeset(),'raw_id'),other_ref_type='rev',other_ref_name=c.cs_ranges[-1].raw_id)}" class="btn btn-small"><i class="icon-loop"></i> Compare Revisions</a>
                 </div>
             </div>
         </div>
--- a/kallithea/templates/changeset/diff_block.html	Fri Jun 28 02:26:13 2013 +0200
+++ b/kallithea/templates/changeset/diff_block.html	Fri Jun 28 11:50:13 2013 +0200
@@ -59,13 +59,13 @@
           <div class="changeset_header">
               <div class="changeset_file">
                   ${h.safe_unicode(filenode_path)} |
-                  <a class="spantag" href="${h.url('files_home', repo_name=c.other_repo.repo_name, f_path=filenode_path, revision=c.org_ref)}" title="${_('Show file at latest version in this repo')}">${c.org_ref_type}@${h.short_id(c.org_ref) if c.org_ref_type=='rev' else c.org_ref}</a>
+                  <a class="spantag" href="${h.url('files_home', repo_name=c.other_repo.repo_name, f_path=filenode_path, revision=c.org_rev)}" title="${_('Show file at latest version in this repo')}">${c.org_ref_type}@${h.short_id(c.org_ref_name) if c.org_ref_type=='rev' else c.org_ref_name}</a>
                   <i class="icon-arrow-right" style="font-size: 12px;color:#577632"></i>
-                  <a class="spantag" href="${h.url('files_home', repo_name=c.repo_name, f_path=filenode_path, revision=c.other_ref)}" title="${_('Show file at initial version in this repo')}">${c.other_ref_type}@${h.short_id(c.other_ref) if c.other_ref_type=='rev' else c.other_ref}</a>
+                  <a class="spantag" href="${h.url('files_home', repo_name=c.repo_name, f_path=filenode_path, revision=c.other_rev)}" title="${_('Show file at initial version in this repo')}">${c.other_ref_type}@${h.short_id(c.other_ref_name) if c.other_ref_type=='rev' else c.other_ref_name}</a>
               </div>
                <div class="diff-actions">
                 %if c.other_repo.repo_name == c.repo_name:
-                  <a href="${h.url('files_diff_2way_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode_path),diff2=c.other_ref,diff1=c.org_ref,diff='diff',fulldiff=1)}" class="tooltip" title="${h.tooltip(_('Show full side-by-side diff for this file'))}">
+                  <a href="${h.url('files_diff_2way_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode_path),diff2=c.other_rev,diff1=c.org_rev,diff='diff',fulldiff=1)}" class="tooltip" title="${h.tooltip(_('Show full side-by-side diff for this file'))}">
                       <img class="icon" src="${h.url('/images/icons/application_double.png')}"/>
                   </a>
                 %endif
--- a/kallithea/templates/compare/compare_diff.html	Fri Jun 28 02:26:13 2013 +0200
+++ b/kallithea/templates/compare/compare_diff.html	Fri Jun 28 11:50:13 2013 +0200
@@ -5,7 +5,7 @@
     %if c.compare_home:
         ${_('%s Compare') % c.repo_name}
     %else:
-        ${_('%s Compare') % c.repo_name} - ${'%s@%s' % (c.org_repo.repo_name, c.org_ref)} &gt; ${'%s@%s' % (c.other_repo.repo_name, c.other_ref)}
+        ${_('%s Compare') % c.repo_name} - ${'%s@%s' % (c.org_repo.repo_name, c.org_ref_name)} &gt; ${'%s@%s' % (c.other_repo.repo_name, c.other_ref_name)}
     %endif
     %if c.site_name:
         &middot; ${c.site_name}
@@ -93,7 +93,7 @@
    $(document).ready(function(){
     var cache = {}
     $("#compare_org").select2({
-        placeholder: "${'%s@%s' % (c.org_repo.repo_name, c.org_ref)}",
+        placeholder: "${'%s@%s' % (c.org_repo.repo_name, c.org_ref_name)}",
         formatSelection: function(obj){
             return '{0}@{1}'.format("${c.org_repo.repo_name}", obj.text)
         },
@@ -133,7 +133,7 @@
         },
     });
     $("#compare_other").select2({
-        placeholder: "${'%s@%s' % (c.other_repo.repo_name, c.other_ref)}",
+        placeholder: "${'%s@%s' % (c.other_repo.repo_name, c.other_ref_name)}",
         dropdownAutoWidth: true,
         formatSelection: function(obj){
             return '{0}@{1}'.format("${c.other_repo.repo_name}", obj.text)
@@ -177,7 +177,7 @@
         var org = $('#compare_org').select2('data');
         var other = $('#compare_other').select2('data');
 
-        var compare_url = "${h.url('compare_url',repo_name=c.repo_name,org_ref_type='__other_ref_type__',org_ref='__org__',other_ref_type='__org_ref_type__',other_ref='__other__', other_repo=c.other_repo.repo_name)}";
+        var compare_url = "${h.url('compare_url',repo_name=c.repo_name,org_ref_type='__other_ref_type__',org_ref_name='__org__',other_ref_type='__org_ref_type__',other_ref_name='__other__', other_repo=c.other_repo.repo_name)}";
         var u = compare_url.replace('__other_ref_type__',org.type)
                            .replace('__org__',org.text)
                            .replace('__org_ref_type__',other.type)
--- a/kallithea/templates/forks/forks_data.html	Fri Jun 28 02:26:13 2013 +0200
+++ b/kallithea/templates/forks/forks_data.html	Fri Jun 28 11:50:13 2013 +0200
@@ -17,7 +17,7 @@
             <div class="follower_date">${_('Forked')} -
                 <span class="tooltip" title="${h.tooltip(h.fmt_date(f.created_on))}"> ${h.age(f.created_on)}</span>
                 <a title="${_('Compare fork with %s' % c.repo_name)}"
-                   href="${h.url('compare_url',repo_name=c.repo_name, org_ref_type=c.db_repo.landing_rev[0],org_ref=c.db_repo.landing_rev[1],other_repo=f.repo_name,other_ref_type=c.db_repo.landing_rev[0],other_ref=c.db_repo.landing_rev[1], merge=1)}"
+                   href="${h.url('compare_url',repo_name=c.repo_name, org_ref_type=c.db_repo.landing_rev[0],org_ref_name=c.db_repo.landing_rev[1],other_repo=f.repo_name,other_ref_type=c.db_repo.landing_rev[0],other_ref_name=c.db_repo.landing_rev[1], merge=1)}"
                    class="btn btn-small"><i class="icon-loop"></i> ${_('Compare fork')}</a>
             </div>
             <div style="border-bottom: 1px solid #DDD;margin:10px 0px 10px 0px"></div>
--- a/kallithea/templates/pullrequests/pullrequest.html	Fri Jun 28 02:26:13 2013 +0200
+++ b/kallithea/templates/pullrequests/pullrequest.html	Fri Jun 28 11:50:13 2013 +0200
@@ -171,11 +171,11 @@
       //url template
       var url = "${h.url('compare_url',
                          repo_name='__other_repo__',
-                         org_ref_type='__other_ref_type__',
-                         org_ref='__other_ref__',
+                         org_ref_type='rev',
+                         org_ref_name='__other_ref_name__',
                          other_repo='__org_repo__',
-                         other_ref_type='__org_ref_type__',
-                         other_ref='__org_ref__',
+                         other_ref_type='rev',
+                         other_ref_name='__org_ref_name__',
                          as_form=True,
                          merge=True,
                          )}";
@@ -187,16 +187,14 @@
 
       var select_refs = YUQ('#pull_request_form select.refs')
       var rev_data = {
-          'org_repo': org_repo,
-          'org_ref': org_ref[2],
-          'org_ref_type': 'rev',
-          'other_repo': other_repo,
-          'other_ref': other_ref[2],
-          'other_ref_type': 'rev',
+          '__org_repo__': org_repo,
+          '__org_ref_name__': org_ref[2],
+          '__other_repo__': other_repo,
+          '__other_ref_name__': other_ref[2],
       }; // gather the org/other ref and repo here
 
       for (k in rev_data){
-          url = url.replace('__'+k+'__',rev_data[k]);
+          url = url.replace(k,rev_data[k]);
       }
 
       YUD.get('pull_request_overview').innerHTML = "${_('Loading ...')}";
--- a/kallithea/templates/pullrequests/pullrequest_show.html	Fri Jun 28 02:26:13 2013 +0200
+++ b/kallithea/templates/pullrequests/pullrequest_show.html	Fri Jun 28 11:50:13 2013 +0200
@@ -72,7 +72,7 @@
               <span><a href="${h.url('summary_home', repo_name=c.pull_request.org_repo.repo_name)}">${c.pull_request.org_repo.clone_url()}</a></span>
 
               ## branch link is only valid if it is a branch
-              <span class="spantag"><a href="${h.url('summary_home', repo_name=c.pull_request.org_repo.repo_name, anchor=c.pull_request.org_ref_parts[1])}">${c.pull_request.org_ref_parts[0]}: ${c.pull_request.org_ref_parts[1]}</a></span>
+              <span class="spantag"><a href="${h.url('summary_home', repo_name=c.pull_request.org_repo.repo_name, anchor=c.org_ref_name)}">${c.org_ref_type}: ${c.org_ref_name}</a></span>
               </div>
           </div>
          </div>
--- a/kallithea/templates/tags/tags.html	Fri Jun 28 02:26:13 2013 +0200
+++ b/kallithea/templates/tags/tags.html	Fri Jun 28 11:50:13 2013 +0200
@@ -39,7 +39,7 @@
     var other = YUQ('input[name=compare_other]:checked')[0];
 
     if(org && other){
-        var compare_url = "${h.url('compare_url',repo_name=c.repo_name,org_ref_type='tag',org_ref='__ORG__',other_ref_type='tag',other_ref='__OTHER__')}";
+        var compare_url = "${h.url('compare_url',repo_name=c.repo_name,org_ref_type='tag',org_ref_name='__ORG__',other_ref_type='tag',other_ref_name='__OTHER__')}";
         var u = compare_url.replace('__ORG__',org.value)
                            .replace('__OTHER__',other.value);
         window.location=u;
--- a/kallithea/tests/functional/test_compare.py	Fri Jun 28 02:26:13 2013 +0200
+++ b/kallithea/tests/functional/test_compare.py	Fri Jun 28 11:50:13 2013 +0200
@@ -86,10 +86,10 @@
         response = self.app.get(url('compare_url',
                                     repo_name=repo1.repo_name,
                                     org_ref_type="branch",
-                                    org_ref=rev2,
+                                    org_ref_name=rev2,
                                     other_repo=repo2.repo_name,
                                     other_ref_type="branch",
-                                    other_ref=rev1,
+                                    other_ref_name=rev1,
                                     merge='1',))
 
         response.mustcontain('%s@%s' % (repo1.repo_name, rev2))
@@ -134,10 +134,10 @@
         response = self.app.get(url('compare_url',
                                     repo_name=repo1.repo_name,
                                     org_ref_type="branch",
-                                    org_ref=rev2,
+                                    org_ref_name=rev2,
                                     other_repo=repo2.repo_name,
                                     other_ref_type="branch",
-                                    other_ref=rev1,
+                                    other_ref_name=rev1,
                                     merge='1',))
 
         response.mustcontain('%s@%s' % (repo1.repo_name, rev2))
@@ -189,10 +189,10 @@
         response = self.app.get(url('compare_url',
                                     repo_name=repo1.repo_name,
                                     org_ref_type="branch",
-                                    org_ref=rev2,
+                                    org_ref_name=rev2,
                                     other_repo=repo2.repo_name,
                                     other_ref_type="branch",
-                                    other_ref=rev1,
+                                    other_ref_name=rev1,
                                     merge='1',))
 
         response.mustcontain('%s@%s' % (repo1.repo_name, rev2))
@@ -244,10 +244,10 @@
         response = self.app.get(url('compare_url',
                                     repo_name=repo1.repo_name,
                                     org_ref_type="branch",
-                                    org_ref=rev2,
+                                    org_ref_name=rev2,
                                     other_repo=repo2.repo_name,
                                     other_ref_type="branch",
-                                    other_ref=rev1,
+                                    other_ref_name=rev1,
                                     merge='1',))
 
         response.mustcontain('%s@%s' % (repo1.repo_name, rev2))
@@ -307,10 +307,10 @@
         response = self.app.get(url('compare_url',
                                     repo_name=repo2.repo_name,
                                     org_ref_type="rev",
-                                    org_ref=cs1.short_id,  # parent of cs2, in repo2
+                                    org_ref_name=cs1.short_id,  # parent of cs2, in repo2
                                     other_repo=repo1.repo_name,
                                     other_ref_type="rev",
-                                    other_ref=cs4.short_id,
+                                    other_ref_name=cs4.short_id,
                                     merge='True',
                                     ))
         response.mustcontain('%s@%s' % (repo2.repo_name, cs1.short_id))
@@ -369,9 +369,9 @@
         response = self.app.get(url('compare_url',
                                     repo_name=repo1.repo_name,
                                     org_ref_type="rev",
-                                    org_ref=cs2.short_id, # parent of cs3, not in repo2
+                                    org_ref_name=cs2.short_id, # parent of cs3, not in repo2
                                     other_ref_type="rev",
-                                    other_ref=cs5.short_id,
+                                    other_ref_name=cs5.short_id,
                                     merge='1',))
 
         response.mustcontain('%s@%s' % (repo1.repo_name, cs2.short_id))
@@ -404,9 +404,9 @@
         response = self.app.get(url('compare_url',
                                     repo_name=HG_REPO,
                                     org_ref_type="rev",
-                                    org_ref=rev1,
+                                    org_ref_name=rev1,
                                     other_ref_type="rev",
-                                    other_ref=rev2,
+                                    other_ref_name=rev2,
                                     other_repo=HG_FORK,
                                     merge='1',))
 
@@ -434,9 +434,9 @@
         response = self.app.get(url('compare_url',
                                     repo_name=GIT_REPO,
                                     org_ref_type="rev",
-                                    org_ref=rev1,
+                                    org_ref_name=rev1,
                                     other_ref_type="rev",
-                                    other_ref=rev2,
+                                    other_ref_name=rev2,
                                     other_repo=GIT_FORK,
                                     merge='1',))
 
@@ -500,9 +500,9 @@
         response = self.app.get(url('compare_url',
                                     repo_name=r2_name,
                                     org_ref_type="branch",
-                                    org_ref=rev1,
+                                    org_ref_name=rev1,
                                     other_ref_type="branch",
-                                    other_ref=rev2,
+                                    other_ref_name=rev2,
                                     other_repo=r1_name,
                                     merge='1',))
 
@@ -521,9 +521,9 @@
         response = self.app.get(url('compare_url',
                                     repo_name=r2_name,
                                     org_ref_type="branch",
-                                    org_ref=rev1,
+                                    org_ref_name=rev1,
                                     other_ref_type="branch",
-                                    other_ref=rev2,
+                                    other_ref_name=rev2,
                                     other_repo=r1_name,
                                     merge='1',
                                     ))
@@ -582,9 +582,9 @@
         response = self.app.get(url('compare_url',
                                     repo_name=r2_name,
                                     org_ref_type="branch",
-                                    org_ref=rev1,
+                                    org_ref_name=rev1,
                                     other_ref_type="branch",
-                                    other_ref=rev2,
+                                    other_ref_name=rev2,
                                     other_repo=r1_name,
                                     merge='1',))
 
@@ -603,9 +603,9 @@
         response = self.app.get(url('compare_url',
                                     repo_name=r2_name,
                                     org_ref_type="branch",
-                                    org_ref=rev1,
+                                    org_ref_name=rev1,
                                     other_ref_type="branch",
-                                    other_ref=rev2,
+                                    other_ref_name=rev2,
                                     other_repo=r1_name,
                                     merge='1',
                                     ))
--- a/kallithea/tests/functional/test_compare_local.py	Fri Jun 28 02:26:13 2013 +0200
+++ b/kallithea/tests/functional/test_compare_local.py	Fri Jun 28 11:50:13 2013 +0200
@@ -10,9 +10,9 @@
         response = self.app.get(url('compare_url',
                                     repo_name=HG_REPO,
                                     org_ref_type="tag",
-                                    org_ref=tag1,
+                                    org_ref_name=tag1,
                                     other_ref_type="tag",
-                                    other_ref=tag2,
+                                    other_ref_name=tag2,
                                     ), status=200)
         response.mustcontain('%s@%s' % (HG_REPO, tag1))
         response.mustcontain('%s@%s' % (HG_REPO, tag2))
@@ -48,9 +48,9 @@
         response = self.app.get(url('compare_url',
                                     repo_name=GIT_REPO,
                                     org_ref_type="tag",
-                                    org_ref=tag1,
+                                    org_ref_name=tag1,
                                     other_ref_type="tag",
-                                    other_ref=tag2,
+                                    other_ref_name=tag2,
                                     ), status=200)
         response.mustcontain('%s@%s' % (GIT_REPO, tag1))
         response.mustcontain('%s@%s' % (GIT_REPO, tag2))
@@ -84,9 +84,9 @@
         response = self.app.get(url('compare_url',
                                     repo_name=HG_REPO,
                                     org_ref_type="branch",
-                                    org_ref='default',
+                                    org_ref_name='default',
                                     other_ref_type="branch",
-                                    other_ref='default',
+                                    other_ref_name='default',
                                     ))
 
         response.mustcontain('%s@default' % (HG_REPO))
@@ -100,9 +100,9 @@
         response = self.app.get(url('compare_url',
                                     repo_name=GIT_REPO,
                                     org_ref_type="branch",
-                                    org_ref='master',
+                                    org_ref_name='master',
                                     other_ref_type="branch",
-                                    other_ref='master',
+                                    other_ref_name='master',
                                     ))
 
         response.mustcontain('%s@master' % (GIT_REPO))
@@ -119,9 +119,9 @@
         response = self.app.get(url('compare_url',
                                     repo_name=HG_REPO,
                                     org_ref_type="rev",
-                                    org_ref=rev1,
+                                    org_ref_name=rev1,
                                     other_ref_type="rev",
-                                    other_ref=rev2,
+                                    other_ref_name=rev2,
                                     ))
         response.mustcontain('%s@%s' % (HG_REPO, rev1))
         response.mustcontain('%s@%s' % (HG_REPO, rev2))
@@ -141,9 +141,9 @@
         response = self.app.get(url('compare_url',
                                     repo_name=GIT_REPO,
                                     org_ref_type="rev",
-                                    org_ref=rev1,
+                                    org_ref_name=rev1,
                                     other_ref_type="rev",
-                                    other_ref=rev2,
+                                    other_ref_name=rev2,
                                     ))
         response.mustcontain('%s@%s' % (GIT_REPO, rev1))
         response.mustcontain('%s@%s' % (GIT_REPO, rev2))