PageRenderTime 23ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/packages/acs-admin/www/apm/version-tag.tcl

https://github.com/iuri/PWTI
TCL | 129 lines | 112 code | 13 blank | 4 comment | 4 complexity | 6162a87bf15b4fbf7c737bf3c02ed041 MD5 | raw file
  1. ad_page_contract {
  2. Tag each file in a package as part of a particular package version.
  3. @param version_id The package to be processed.
  4. @author ron@arsdigita.com
  5. @creation-date 9 May 2000
  6. @cvs-id $Id: version-tag.tcl,v 1.6 2008/10/04 20:12:51 emmar Exp $
  7. } {
  8. {version_id:integer}
  9. }
  10. db_1row apm_package_by_version_id {}
  11. if { $installed_p eq "f" } {
  12. ad_return_complaint 1 "<li>The selected version is not installed"
  13. return
  14. }
  15. set files [db_list apm_all_paths {}]
  16. if { [llength $files] == 0 } {
  17. ad_return_complaint 1 "<li>No files in this packages"
  18. return
  19. }
  20. # Create a legal CVS tag to mark the files by substituting -'s for all
  21. # of the .'s in the version_name. The other rules for a legal version
  22. # name are compatible with CVS.
  23. set version_tag [apm_package_version_release_tag $package_key $version_name]
  24. # Path to the CVS executable
  25. set cvs [parameter::get -package_id [ad_acs_kernel_id] -parameter CvsPath]
  26. doc_body_append [apm_header [list "version-view?version_id=$version_id" "$pretty_name $version_name"] [list "version-files?version_id=$version_id" "Files"] "Tag"] \
  27. "<p> We're going to write the CVS tag <code>$version_tag</code> into
  28. the repository for each file in this package. This will let you
  29. retrieve the exact set of revisions that make up
  30. $pretty_name $version_name in the future. You can repeat
  31. this operation as often as you want, to tag new files for example.
  32. <p>Here goes:
  33. <blockquote>
  34. <pre>
  35. "
  36. # Check for the existence of CVS/Root as a basic check that each file is
  37. # under version control. No error handling yet.
  38. set bad_file_count 0
  39. set files_to_add [list]
  40. set files_to_commit [list]
  41. foreach path $files {
  42. global vc_file_props
  43. vc_parse_cvs_status [apm_fetch_cached_vc_status "packages/$package_key/$path"]
  44. switch $vc_file_props(status) {
  45. "Up-to-date" {
  46. set full_path [acs_package_root_dir $package_key]/$path
  47. exec $cvs tag -F $version_tag $full_path
  48. set status "T $path"
  49. }
  50. "Locally Modified" {
  51. incr bad_file_count
  52. lappend files_to_commit $path
  53. set status "M $path (Locally Modified)"
  54. }
  55. default {
  56. incr bad_file_count
  57. lappend files_to_add $path
  58. set status "I $path (No CVS Information)"
  59. }
  60. }
  61. doc_body_append "$status\n"
  62. doc_body_flush
  63. }
  64. doc_body_append "
  65. </pre>
  66. </blockquote>
  67. "
  68. # Update the versions table to indicate whether or not this version
  69. # was successfully tagged.
  70. if {$bad_file_count} {
  71. doc_body_append "<p> Some of your files could not be tagged."
  72. if { [llength $files_to_commit] } {
  73. doc_body_append "
  74. <p> The following have local modifications that have not yet been committed.
  75. To commit them use:
  76. <blockquote><pre>cd [acs_package_root_dir $package_key]\n"
  77. apm_write_shell_wrap [concat [list cvs commit] $files_to_commit]
  78. doc_body_append "</pre></blockquote>"
  79. }
  80. if { [llength $files_to_add] } {
  81. doc_body_append "
  82. <p>The following have not been added to the CVS repository. To add them use:
  83. <blockquote><pre>ad [acs_package_root_dir $package_key]\n"
  84. apm_write_shell_wrap [concat [list cvs add] $files_to_add]
  85. doc_body_append "</pre></blockquote>"
  86. }
  87. doc_body_append "<p> After correcting the above problems you can reload
  88. this page or run the tagging operation again. This package won't
  89. be archivable until the tagging is completed with no errors."
  90. db_dml apm_all_files_untag {}
  91. } else {
  92. doc_body_append "<p>All files were tagged successfully."
  93. db_dml apm_all_files_tag {}
  94. }
  95. doc_body_append "
  96. <p>
  97. <a href=version-files?version_id=$version_id>Return to the Package Manager.</a>
  98. [ad_footer]
  99. "