0059.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Apache Subversion Basics with TortoiseSVN</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta charset="UTF-8">
  7. <meta name="keywords" content="How To,Tutorial,i12bretro,Subversion,Apache,TortoiseSVN,SVN,Source Code,Code Repository,Self-hosted,Basic Usage">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="Apache Subversion Basics with TortoiseSVN">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  12. <script type="text/javascript">
  13. $(function(){
  14. $('textarea').each(function(i,e){
  15. theTextarea = $(this);
  16. theTextarea.height((theTextarea[0].scrollHeight-5) +'px');
  17. });
  18. $('li').each(function(i,e){
  19. if(!$(this).hasClass('noCheckbox')){
  20. var uuid = 'li_' + Math.floor(Math.random() * Math.floor(1000000)).toString() + '_' + i.toString();
  21. $(this).contents().wrap('<span id="'+ uuid +'"><label for="cb_'+ uuid +'"></label></span>');
  22. $(this).prepend('<input type="checkbox" class="completeBox" id="cb_' + uuid +'" rel="'+ uuid +'" />')
  23. }
  24. });
  25. $('code,div.codeBlock,textarea.codeBlock').each(function(i,e){
  26. theElement = $(this);
  27. var lines = theElement.html().split("\n");
  28. theElement.empty();
  29. for(l=0;l<lines.length;l++){
  30. if($.trim(lines[l]) != '' && $.trim(lines[l]).substr(0,1) != '#' && $.trim(lines[l]).indexOf(' #') == -1 && lines[l].substr(0, 4).toUpperCase() != 'REM '){
  31. theElement.append('<input type="image" src="images/clipboard.png" value="" class="copy-text" rel="copy_'+ i +'_'+ l +'" data-clipboard-text="'+ $.trim(lines[l].replace(/"/g, '&quot;')) +'" /><span id="copy_'+ i +'_'+ l +'">'+ lines[l] +'</span>');
  32. } else {
  33. theElement.append(lines[l]);
  34. }
  35. }
  36. });
  37. $(document).on('click','input.copy-text',function(){
  38. theButton = $(this);
  39. $('input.copy-text').attr('src','images/clipboard.png');
  40. $('span.copy-animation,span.copy-animation-ps').removeClass('copy-animation copy-animation-ps');
  41. try {
  42. if($('#'+ theButton.attr('rel')).parent('div').hasClass('PS')){
  43. $('#'+ theButton.attr('rel')).addClass('copy-animation-ps');
  44. } else if($('#'+ theButton.attr('rel')).parent('div').hasClass('CMD')){
  45. $('#'+ theButton.attr('rel')).addClass('copy-animation-cmd');
  46. } else {
  47. $('#'+ theButton.attr('rel')).addClass('copy-animation');
  48. }
  49. navigator.clipboard.writeText(theButton.data('clipboard-text').replace(/<[^>]*>?/gm, ''));
  50. theButton.attr('src','images/clipboard_active.png');
  51. } catch(err) {
  52. }
  53. return false;
  54. });
  55. $(document).on('click','input.completeBox',function(){
  56. theBox = $(this);
  57. $('#'+ theBox.attr('rel')).addClass('strikethrough');
  58. theBox.prop('disabled',true);
  59. theBox.parent('li').prevAll().each(function(i,e){
  60. theLI = $(this);
  61. if(theLI.find('input[type=checkbox]').not(':checked')){
  62. $('#'+ theLI.find('input[type=checkbox]').attr('rel')).addClass('strikethrough');
  63. theLI.find('input[type=checkbox]').prop('checked',true).prop('disabled',true);
  64. }
  65. });
  66. });
  67. if(window.self !== window.top){
  68. window.parent.$('iframe.stepsFrame').height((this['scrollingElement']['scrollHeight']+20) +'px');
  69. }
  70. });
  71. </script>
  72. <link href="css/steps.css" rel="stylesheet" type="text/css" />
  73. </head>
  74. <body>
  75. <div id="gridContainer">
  76. <div class="topMargin"></div>
  77. <div id="listName" class="topMargin">
  78. <h1>Apache Subversion Basics with TortoiseSVN</h1>
  79. </div>
  80. <div></div>
  81. <div id="content">
  82. <h2>Install&nbsp;TortoiseSVN</h2>
  83. <ol>
  84. <li>Download TortoiseSVN <a href="https://tortoisesvn.net/downloads.html" target="_blank">Download</a></li>
  85. <li>Install TortoiseSVN</li>
  86. </ol>
  87. <h2>Creating a New Repository</h2>
  88. <ol>
  89. <li>Navigate to where you are storing your Subversion repository databases</li>
  90. <li>Create a new folder matching the application name</li>
  91. <li>Inside the new folder, right click in the whitespace &gt; TortoiseSVN &gt; Create respository here</li>
  92. <li>When the dialog appears, click the Create folder structure option, this will create the standard &quot;trunk&quot;, &quot;branches&quot; and &quot;tags&quot; directories inside the new repository</li>
  93. </ol>
  94. <h2>Creating a Working Directory</h2>
  95. <ol>
  96. <li>Create a folder to contain the working copy of the code, this could be on a development web server</li>
  97. <li>Inside the new application folder, right click in the whitespace &gt; SVN Checkout...</li>
  98. <li>Input the URL&nbsp;to the repository to work with, this can be either a file:// or http(s)://&nbsp;URL if Apache HTTPD has been setup for Subversion (Video link: )<br />
  99. Examples:<br />
  100. file:///E:/SVN_Repos/new_code/trunk<br />
  101. https://svn.i12bretro.local/new_code/trunk</li>
  102. </ol>
  103. <h2>Committing Changes to the Repository</h2>
  104. <ol>
  105. <li>After completing code changes, right click in the white space of the working directory &gt; SVN Commit...</li>
  106. <li>Input <u>meaningful comments</u> about the changes completed</li>
  107. <li>Click OK</li>
  108. </ol>
  109. <h2>Importing Existing Code Into Subversion</h2>
  110. <ol>
  111. <li>Create the Subversion repository using the steps above</li>
  112. <li>Navigate to the folder that contains your code</li>
  113. <li>Right click in the whitespace &gt; TortoiseSVN &gt; Import...</li>
  114. <li>Input the URL&nbsp;to the repository to work with, this can be either a file:// or http(s)://&nbsp;URL if Apache HTTPD has been setup for Subversion (Video link: )<br />
  115. Examples:<br />
  116. file:///E:/SVN_Repos/import_code/trunk<br />
  117. http://svn.i12bretro.local/import_code/trunk</li>
  118. <li>Input a meaningful comment&nbsp;about the state of the code being imported</li>
  119. <li>To convert the current directory into a working directory after successfully importing the code into the repository, simply&nbsp;right click in the whitespace &gt; SVN Checkout...</li>
  120. <li>Input the&nbsp;URL&nbsp;to the repository to work with</li>
  121. <li>Verify the checkout path, making sure no unwanted sub-directories were added based on the repository URL (for example, I&#39;ve found that TortoiseSVN will add /trunk to the checkout directory)</li>
  122. <li>Click OK</li>
  123. <li>A dialog will display stating that the directory selected is not empty &gt; Confirm the target folder path and Click Checkout</li>
  124. </ol>
  125. <h2>Deploying Updates with Subversion Workflow</h2>
  126. <ol>
  127. <li>After completing development and testing the code, you&#39;ll be ready to deploy it to a production environment</li>
  128. <li>Navigate to the folder on the production environment &gt; Right click in the whitespace &gt; SVN Checkout...</li>
  129. <li>Input the URL&nbsp;to the repository to work with, this can be either a file:// or http(s)://&nbsp;URL if Apache HTTPD has been setup for Subversion<br />
  130. Examples:<br />
  131. file:///E:/SVN_Repos/import_code/trunk<br />
  132. https://svn.i12bretro.local/import_code/trunk</li>
  133. <li>After the checkout completes the production directory will contain an exact copy of code in&nbsp;/trunk of the repository</li>
  134. </ol>
  135. <h2>Relocating Subversion Repository</h2>
  136. <p>This is useful if the location (file path or URL) of the repository has changed but the repository remains the same. For example, migrating to a new server or from file paths to Apache HTTPD based URLs</p>
  137. <ol>
  138. <li>Navigate to the working directory in Windows Explorer</li>
  139. <li>Right click in the white space&nbsp;&gt; TortoiseSVN &gt; Relocate...</li>
  140. <li>Input the URL&nbsp;to the new location of the matching repository<br />
  141. Examples:<br />
  142. file:///E:/SVN_Repos/import_code/trunk<br />
  143. https://svn.i12bretro.local/import_code/trunk</li>
  144. <li>A dialog stating the relocate succeeded should be displayed</li>
  145. <li>Right click in the white space &gt; TortoiseSVN &gt; Repo-browser</li>
  146. <li>The new updated URL should be displayed</li>
  147. </ol>
  148. <h2>Tagging Releases</h2>
  149. <p>Once development and testing are completed for a version of the code, you can create a tag in Subversion. This is a snapshot of the code set and can we used to roll back to the exact version in the future if needed</p>
  150. <ol>
  151. <li>Right click in the whitespace anywhere in Windows</li>
  152. <li>Select TortoiseSVN &gt; Repo-browser</li>
  153. <li>Input the URL to the repository to work with</li>
  154. <li>Right click on the trunk folder in the left navigation pane &gt; Copy to...</li>
  155. <li>Input the URL to the new tag to create, for example&nbsp;http://svn.i12bretro.local/code_repo/tags/1.0</li>
  156. <li>Click OK</li>
  157. <li>Input a comment such as &quot;Creating v1.0 tag&quot; &gt; Click OK</li>
  158. <li>In the Repo browser, expand the tags directory to see the newly created tag</li>
  159. <li>To revert back to this version of the code, just use the tag URL when checking out into a working directory, for example&nbsp;http://svn.i12bretro.local/code_repo/tags/1.0</li>
  160. </ol>
  161. <h2>Include a directory in the repository, but ignore its contents</h2>
  162. <p>This scenario is useful for a directory that is required by the application but where the contents is unique to the deployment. For example, an upload, temp, log or attachment directory.</p>
  163. <ol>
  164. <li>Right click on the directory &gt; TortoiseSVN &gt; Properties</li>
  165. <li>Click the New... button &gt; Other</li>
  166. <li>Select svn:ignore from the Property name dropdown</li>
  167. <li>Type * in the Property value field</li>
  168. <li>Click OK</li>
  169. <li>Right click in the white space &gt; SVN Commit...</li>
  170. <li>Type a meaningful comment denoting the change</li>
  171. <li>Click OK</li>
  172. </ol>
  173. </div>
  174. </div>
  175. </body>
  176. </html>