Issue #190: Range selection from changelog fails (with git)
Reported by: | Eivind Tagseth |
State: | resolved |
Created on: | 2016-02-12 11:29 |
Updated on: | 2018-05-19 15:15 |
Description
There's something wrong with range selection on the changelog page, at least for git.
Selecting ranges and then creating a pull request or "Shot selected changeset" both fail (500 or 404).
The reason is that the changelog template expliticly uses short revs for the URLs for both these buttons (using only the first 12 bytes of the revision hash). This doesn't work for the git backend, as it compares these revs with the revision hashes retrieved using git log -format %H and git rev-list (both of which return full 40 character hashes) and fails to find the wanted changesets.
I've fixed this on my local install by using the short revision hashes only for display, and sending the full hashes in the URL, but I don't know if this is the correct solution.
Attachments
Comments
Comment by Andrej Shadura, on 2016-02-12 11:41
Thanks for reporting this. I think I'm going to have a look at Git backend, as it's undermaintained, as too few people use it extensively.
Comment by Andrej Shadura, on 2016-02-12 11:42
Comment by domruf, on 2016-02-15 15:03
This would be a quick fix
diff -r 491961dfd0c8 kallithea/templates/changelog/changelog.html --- a/kallithea/templates/changelog/changelog.html Wed Feb 10 18:30:27 2016 +0100 +++ b/kallithea/templates/changelog/changelog.html Mon Feb 15 15:59:39 2016 +0100 @@ -182,25 +182,25 @@ if ($checked_checkboxes.length > 0) { $checked_checkboxes.first().parent('td').append($singlerange); var singlerange = $singlerange.prop('checked'); - var rev_end = $checked_checkboxes.first().prop('name').substr(0, 12); + var rev_end = $checked_checkboxes.first().prop('name'); if ($checked_checkboxes.length > 1 || singlerange) { - var rev_start = $checked_checkboxes.last().prop('name').substr(0, 12); + var rev_start = $checked_checkboxes.last().prop('name'); $('#rev_range_container').prop('href', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}', 'revision': rev_start + '...' + rev_end})); $('#rev_range_container').html( - _TM['Show Selected Changesets {0} → {1}'].format(rev_start, rev_end)); + _TM['Show Selected Changesets {0} → {1}'].format(rev_start.substr(0, 12), rev_end.substr(0, 12))); $('#rev_range_container').show(); $('#open_new_pr').prop('href', pyroutes.url('pullrequest_home', {'repo_name': '${c.repo_name}', 'rev_start': rev_start, 'rev_end': rev_end})); - $('#open_new_pr').html(_TM['Open New Pull Request for {0} → {1}'].format(rev_start, rev_end)); + $('#open_new_pr').html(_TM['Open New Pull Request for {0} → {1}'].format(rev_start.substr(0, 12), rev_end.substr(0, 12))); } else { $('#open_new_pr').prop('href', pyroutes.url('pullrequest_home', {'repo_name': '${c.repo_name}', 'rev_end': rev_end})); - $('#open_new_pr').html(_TM['Open New Pull Request from {0}'].format(rev_end)); + $('#open_new_pr').html(_TM['Open New Pull Request from {0}'].format(rev_end.substr(0, 12))); } $('#rev_range_clear').show();
Comment by domruf, on 2016-02-15 15:15
BTW shouldn't it be possible to create pull requests based on hashes on the pull request dialog page as well?
Comment by Thomas De Schampheleire, on 2016-02-15 16:40
Yes, see 70.html
Comment by Thomas De Schampheleire, on 2018-05-19 15:15
Fixed with 93b512845dab