viewvc-4intranet/templates/include/pathrev_form.ezt

50 lines
1.3 KiB
Plaintext
Raw Normal View History

New URL scheme for Subversion. The problem with the old scheme is it doesn't have a concept of a "sticky" revision. So if you are looking at version 10 of a directory, and click to view a file inside which was last modified in version 6, the fact you were looking at version 10 of the parent directory is not recorded anywhere, and the "Parent Directory" links on the markup page will take you to a version 6 directory listing instead of the listing you came from. This problem exists all over ViewCVS, not just in directory listings, and the result of it is that when you browse a repository by following the provided links you get sent further and further back into the history, all the while seeing incomplete log pages and outdated directory listings which you never asked for. The new URL scheme works by introducing a new 'pathrev' sticky variable and is described in detail in a comment in the _orig_path function in lib/viewcvs.py. The scheme is not backwards compatabile with all (or maybe even most) old subversion URLs. Specifically, any old URL referring to a path that no longer exists in the HEAD will not work. Other subversion URLs will still work. It is still possible to add backwards compatibility. We'd have to rename the rev parameter to something else, so we could know that all URLs with 'rev' in them are old style URLs which need to be redirected. I don't know if it's worth doing this though. This is not an isolated change. I've tried to unite the Subversion "sticky revision" with the present "only_with_tag" logic for CVS. And since I had to go over viewcvs.py with a fine-toothed comb implementing these things, there are also some miscellaneous cleanups there. * lib/vclib/bincvs/__init__.py (_file_log): change filtering so when matching revisions to tag, includes all preceding revisions, not just tag revision itself * lib/viewcvs.py (_sticky_vars): 'only_with_tag' is gone, so change this back into a list with no span-roots values (request.run_viewcvs): read new 'pathrev' parameter and use it when calling repos.itemtype (request.get_link): add 'pathrev' parameter to urls, restore update _sticky_vars loop (_legal_params, prep_tags, build_commit): replace 'only_with_tag' with 'pathrev' (_orig_path): new function (nav_path, common_template_data): stop adding 'rev' parameters to links removed unused 'roots_href' template variable (nav_header_data): add new 'revision_href', 'orig_path', 'orig_href' template variables for use in markup and annotate views (view_markup, view_checkout, view_annotate, setup_diff, generate_tarball, download_tarball): use 'pathrev' when looking up file revision (view_directory): use 'pathrev' when looking up directory revisions instead of 'rev'. stop adding 'rev' to links. add template variables: pathrev, pathrev_action, pathrev_hidden_values. remove unused template variables: num_files, rev, view_tag, has_tags, main_href, jump_rev_action, jump_rev_hidden_values, row.show_log. (view_log): use 'pathrev' to retrieve log information instead of 'rev'. stop linking to original paths of copied files. add template variables: entry.orig_path, entry.orig_href, default_branch, pathrev, pathrev_action, pathrev_hidden_values, branch_tags, plain_tags. remove template variables: entry.filename, entry.prev_path, branch, path_selected, view_tag, branch_names, branch_select_action, branch_select_hidden_values. (view_cvsgraph): use common_template_data instead of nav_header_data, 'pathrev' instead of 'only_with tag' (view_diff): use common_template_data instead of nav_header_data add template variables: path_left, path_right (view_revision): use 'pathrev' instead of 'rev' in links * templates/include/dir_header.ezt rearrange header and add sticky tag/revision row * templates/include/dir_footer.ezt remove tag selector * templates/include/pathrev_form.ezt new, sticky tag/revision selector form based on code from dir_footer.ezt * templates/include/branch.ezt * templates/include/branch_form.ezt * templates/include/view_tag.ezt removed * templates/include/log_header.ezt new, based on branch.ezt and view_tag.ezt * templates/include/log_footer.ezt new * templates/include/log.ezt * templates/include/log_table.ezt include log_header.ezt and log_footer.ezt * templates/include/annotate.ezt * templates/include/diff.ezt * templates/include/markup.ezt show original paths and add view_revision links * cvsgraph.conf.dist replace only_with_tag parameter with pathrev * website/template-authoring-guide.html update template variable information git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1145 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-03 16:31:02 +03:00
<form method="get" action="[pathrev_action]" style="display: inline">
[pathrev_hidden_values]
[is roottype "cvs"]
[define pathrev_selected][pathrev][end]
<select name="pathrev" onchange="submit()">
<option value=""></option>
[if-any branch_tags]
<optgroup label="Branches">
[for branch_tags]
[is branch_tags pathrev]
<option selected>[branch_tags]</option>
[define pathrev_selected][end]
[else]
<option>[branch_tags]</option>
[end]
[end]
</optgroup>
[end]
<optgroup label="Non-branch tags">
[for plain_tags]
[is plain_tags pathrev]
<option selected>[plain_tags]</option>
[define pathrev_selected][end]
[else]
<option>[plain_tags]</option>
[end]
[end]
</optgroup>
[if-any pathrev_selected]
<option selected>[pathrev_selected]</option>
[end]
</select>
[else]
<input type="text" name="pathrev" value="[pathrev]" size="6"/>
[end]
<input type="submit" value="Set" />
</form>
[if-any pathrev]
<form method="get" action="[pathrev_clear_action]" style="display: inline">
[pathrev_clear_hidden_values]
[if-any lastrev]
[is pathrev lastrev][else]<input type="submit" value="Set to [lastrev]">[end]
(<i>Current path doesn't exist after revision <strong>[lastrev]</strong></i>)
[else]
<input type="submit" value="Clear">
[end]
New URL scheme for Subversion. The problem with the old scheme is it doesn't have a concept of a "sticky" revision. So if you are looking at version 10 of a directory, and click to view a file inside which was last modified in version 6, the fact you were looking at version 10 of the parent directory is not recorded anywhere, and the "Parent Directory" links on the markup page will take you to a version 6 directory listing instead of the listing you came from. This problem exists all over ViewCVS, not just in directory listings, and the result of it is that when you browse a repository by following the provided links you get sent further and further back into the history, all the while seeing incomplete log pages and outdated directory listings which you never asked for. The new URL scheme works by introducing a new 'pathrev' sticky variable and is described in detail in a comment in the _orig_path function in lib/viewcvs.py. The scheme is not backwards compatabile with all (or maybe even most) old subversion URLs. Specifically, any old URL referring to a path that no longer exists in the HEAD will not work. Other subversion URLs will still work. It is still possible to add backwards compatibility. We'd have to rename the rev parameter to something else, so we could know that all URLs with 'rev' in them are old style URLs which need to be redirected. I don't know if it's worth doing this though. This is not an isolated change. I've tried to unite the Subversion "sticky revision" with the present "only_with_tag" logic for CVS. And since I had to go over viewcvs.py with a fine-toothed comb implementing these things, there are also some miscellaneous cleanups there. * lib/vclib/bincvs/__init__.py (_file_log): change filtering so when matching revisions to tag, includes all preceding revisions, not just tag revision itself * lib/viewcvs.py (_sticky_vars): 'only_with_tag' is gone, so change this back into a list with no span-roots values (request.run_viewcvs): read new 'pathrev' parameter and use it when calling repos.itemtype (request.get_link): add 'pathrev' parameter to urls, restore update _sticky_vars loop (_legal_params, prep_tags, build_commit): replace 'only_with_tag' with 'pathrev' (_orig_path): new function (nav_path, common_template_data): stop adding 'rev' parameters to links removed unused 'roots_href' template variable (nav_header_data): add new 'revision_href', 'orig_path', 'orig_href' template variables for use in markup and annotate views (view_markup, view_checkout, view_annotate, setup_diff, generate_tarball, download_tarball): use 'pathrev' when looking up file revision (view_directory): use 'pathrev' when looking up directory revisions instead of 'rev'. stop adding 'rev' to links. add template variables: pathrev, pathrev_action, pathrev_hidden_values. remove unused template variables: num_files, rev, view_tag, has_tags, main_href, jump_rev_action, jump_rev_hidden_values, row.show_log. (view_log): use 'pathrev' to retrieve log information instead of 'rev'. stop linking to original paths of copied files. add template variables: entry.orig_path, entry.orig_href, default_branch, pathrev, pathrev_action, pathrev_hidden_values, branch_tags, plain_tags. remove template variables: entry.filename, entry.prev_path, branch, path_selected, view_tag, branch_names, branch_select_action, branch_select_hidden_values. (view_cvsgraph): use common_template_data instead of nav_header_data, 'pathrev' instead of 'only_with tag' (view_diff): use common_template_data instead of nav_header_data add template variables: path_left, path_right (view_revision): use 'pathrev' instead of 'rev' in links * templates/include/dir_header.ezt rearrange header and add sticky tag/revision row * templates/include/dir_footer.ezt remove tag selector * templates/include/pathrev_form.ezt new, sticky tag/revision selector form based on code from dir_footer.ezt * templates/include/branch.ezt * templates/include/branch_form.ezt * templates/include/view_tag.ezt removed * templates/include/log_header.ezt new, based on branch.ezt and view_tag.ezt * templates/include/log_footer.ezt new * templates/include/log.ezt * templates/include/log_table.ezt include log_header.ezt and log_footer.ezt * templates/include/annotate.ezt * templates/include/diff.ezt * templates/include/markup.ezt show original paths and add view_revision links * cvsgraph.conf.dist replace only_with_tag parameter with pathrev * website/template-authoring-guide.html update template variable information git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1145 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-03 16:31:02 +03:00
</form>
[end]