version_control.html 11 KB

123456789101112131415161718192021222324252627
  1. <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]--><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="Asciidoctor 1.5.4"><meta name="keywords" content="documentation, sdk, editor, tool"><title>jMonkeyEngine SDK: Version Control</title><link rel="stylesheet" href="./asciidoctor.css">
  2. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
  3. <link rel="stylesheet" href="./coderay-asciidoctor.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css"></head><body class="article toc2 toc-left"><div id="header"><div id="toolbar"><a href="https://github.com/jMonkeyEngine/wiki/edit/master/src/docs/asciidoc/sdk/version_control.adoc"><i class="fa fa-pencil-square" aria-hidden="true"></i></a><a href="https://github.com/jMonkeyEngine/wiki/new/master/src/docs/asciidoc/sdk/"><i class="fa fa-plus-square" aria-hidden="true"></i></a><input dir="auto" style="position: relative; vertical-align: top;" spellcheck="false" autocomplete="off" class="searchbox__input aa-input" id="doc-search" name="search" placeholder="Search in the doc" required="required" type="search"></div><h1>jMonkeyEngine SDK: Version Control</h1><div class="details"><span class="author" id="author"></span><br><span id="revnumber">version ,</span> <span id="revdate">2016/03/17 20:48</span></div><div id="toc" class="toc2"><div id="toctitle">Table of Contents</div><ul class="sectlevel1"><li><a href="#version-control-systems">Version Control Systems</a></li><li><a href="#creating-a-repository-upload">Creating a Repository (Upload)</a></li><li><a href="#checking-out-a-repository-download">Checking Out a Repository (Download)</a></li><li><a href="#updating-and-committing-changes-send-and-receive">Updating and Committing Changes (Send and Receive)</a></li><li><a href="#comparing-and-reverting-changes">Comparing and Reverting Changes</a></li><li><a href="#no-version-control-local-history">No Version Control? Local History!</a></li></ul></div></div><div id="content"><div id="preamble"><div class="sectionbody"><div class="paragraph"><p>Whether you work in a development team or alone: File versioning is a handy method to keep your code consistent, compare files line-by-line, and even roll back unwanted changes. This documentation shows you how to make the most of the SDK&#8217;s integrated version control features for Subversion, Mercurial, and Git.</p></div>
  4. <div class="paragraph"><p>For every team member, the file versioning workflow is as follows:</p></div>
  5. <div class="olist arabic"><ol class="arabic"><li><p>Once: Download a working copy of the project from the repository (“checkout).</p></li><li><p>Regularly: Upload your own changes to the repository (“commit).</p></li><li><p>Regularly: Download updates by others from the repository (“update).</p></li></ol></div>
  6. <div class="paragraph"><p>Note: Since the jMonkeyEngine SDK is based on the NetBeans Platform framework, you can learn about certain jMonkeyEngine SDK features by reading the corresponding NetBeans IDE tutorials (in the “see also links).</p></div></div></div>
  7. <div class="sect1"><h2 id="version-control-systems">Version Control Systems</h2><div class="sectionbody"><div class="paragraph"><p>The jMonkeyEngine SDK supports various Version Control Systems such as Subversion, Mercurial, and Git. No matter which of them you use, they all share a common user interface.</p></div>
  8. <div class="paragraph"><p>You can use file versioning alone or in a team. The advantages are that you can keep track of changes (who did it, when, and why), you can compare versions line-by-line, you can revert changes to files and lines, merge multiple changes to one file, and you can even undelete files.</p></div></div></div>
  9. <div class="sect1"><h2 id="creating-a-repository-upload">Creating a Repository (Upload)</h2><div class="sectionbody"><div class="paragraph"><p>Requirements:</p></div>
  10. <div class="ulist"><ul><li><p>You must have a project that you want to version.</p></li><li><p>You must have version control software installed (Subversion, Mercurial, or Git) and have initialized a repository.</p><div class="ulist"><ul><li><p>Tip: For Subversion, for example, the init command looks like this example: <code>svnadmin create /home/joe/jMonkeyProjects/MyGame</code></p></li></ul></div></li><li><p>The computer where the repository is to be hosted must be available in your team&#8217;s network, or you will only be able to use your repo locally.</p><div class="ulist"><ul><li><p>Tip: Hosts such as SourceForge, GoogleCode, dev.java.net offer free version control services for open-source projects.</p></li></ul></div></li></ul></div>
  11. <div class="paragraph"><p>Now you create a repository to store your project&#8217;s files.</p></div>
  12. <div class="olist arabic"><ol class="arabic"><li><p>In the jMonkeyEngine SDK, right-click the project in the Projects window and choose Versioning &gt; Import Into Subversion Repository (or initialize Mercurial Project, etc, respectively).</p><div class="ulist"><ul><li><p>Tip: If you haven&#8217;t evaluated yet which system to choose, start with Subversion for now.</p></li></ul></div></li><li><p>Go through the wizard and fill in the fields to set up the repository.</p></li></ol></div></div></div>
  13. <div class="sect1"><h2 id="checking-out-a-repository-download">Checking Out a Repository (Download)</h2><div class="sectionbody"><div class="paragraph"><p>You and your team mates check out (download) the repository to their individual workstations.</p></div>
  14. <div class="olist arabic"><ol class="arabic"><li><p>Go to the Team menu and choose Subversion &gt; Checkout (or Git or Mercurial respectively)</p></li><li><p>Fill in your repo data into the wizard and click Finish.</p><div class="ulist"><ul><li><p>A typical repository <abbr title="Uniform Resource Locator">URL</abbr> looks like this example: <code><a href="http://jmonkeyengine.googlecode.com/svn/trunk/engine">http://jmonkeyengine.googlecode.com/svn/trunk/engine</a></code></p></li><li><p>If you want to be able to submit changes, you must have a username and password to this repository. Otherwise leave these fields blank.</p></li></ul></div></li><li><p>The repository is downloaded and stored in the location you chose.</p></li><li><p>Use the File &gt; Open Project menu to open the checkout as project and start working.</p><div class="ulist"><ul><li><p>If the checkout is not recognized you need to choose File &gt; New Project from Existing Sources</p></li></ul></div></li></ol></div>
  15. <div class="paragraph"><p>Of course you can also check out existing repositories and access code from other open-source projects (e.g. SourceForge, GoogleCode, dev.java.net).</p></div></div></div>
  16. <div class="sect1"><h2 id="updating-and-committing-changes-send-and-receive">Updating and Committing Changes (Send and Receive)</h2><div class="sectionbody"><div class="paragraph"><p>Receiving the latest changes from the team&#8217;s repository is referred to as <code>updating</code>. Sending your changes to the team&#8217;s repository is refered to as <code>commiting</code>.</p></div>
  17. <div class="olist arabic"><ol class="arabic"><li><p>Before making changes, right-click the project and select Subversion &gt; Update to make sure you have the latest revision.</p><div class="ulist"><ul><li><p>Get in the habit of updating regularly, always before you edit a version controlled file. It will spare you much grief.</p></li></ul></div></li><li><p>After making changes to the project, make certain your change did not break anything.</p><div class="olist loweralpha"><ol class="loweralpha" type="a"><li><p>Update, build, run, test.</p></li><li><p>Look at the red/green/blue marks in the editor to review what you have deleted/added/changed. Click the marks to review all differences in a file.</p></li><li><p>Choose Subversion &gt; Show Changes to see all files that were recently changed – by you and other team members.</p></li><li><p><em>Update again</em> in case your team mates made changes while you were reviewing.</p></li></ol></div></li><li><p>If there are no conflicts and you want to commit your changes, choose Subversion &gt; Commit from the menu.</p></li><li><p>Write a commit message describing what you changed.</p><div class="ulist"><ul><li><p>Remember, you are writing “a message to your future self. Never write redundant stuff like “I changed something.</p></li></ul></div></li></ol></div></div></div>
  18. <div class="sect1"><h2 id="comparing-and-reverting-changes">Comparing and Reverting Changes</h2><div class="sectionbody"><div class="ulist"><ul><li><p>If you and another committer edited the same line, there is a conflict, and the jMonkeyEngine SDK will show an error message.</p><div class="ulist"><ul><li><p>Right-click a file Choose Subversion &gt; Resolve Conflict</p><div class="olist lowerroman"><ol class="lowerroman" type="i"><li><p>Compare the conflicting versions. Press the buttons to accept or reject each change individually.</p></li><li><p>After the resolver shows green, save the resolution.</p></li><li><p>Build and test the resolution, update, and commit.</p></li></ol></div></li></ul></div></li><li><p>Right-click a file and choose Subversion &gt; Search History.</p><div class="ulist"><ul><li><p>You can inspect a file&#8217;s history and see who changed what, why, and when.</p></li><li><p>You can roll back a file to a historic version if necessary.</p></li></ul></div></li><li><p>In general, you can choose Subversion &gt; Diff for any file to see two versions of a file next to each other.</p></li></ul></div></div></div>
  19. <div class="sect1"><h2 id="no-version-control-local-history">No Version Control? Local History!</h2><div class="sectionbody"><div class="paragraph"><p>If you do not use any version control, you can still track changes in projects to a certain degree.</p></div>
  20. <div class="ulist"><ul><li><p>Right-click a file or directory and choose Local History to show or revert changes, or undelete files.</p></li><li><p>You can also select any two files in the Project window and choose Tools &gt; Diff to compare them.</p></li><li><p>Local History only works for files edited in jMonkeyEngine SDK Projects (It does not work for other files, e.g. in the Favorites window.)</p></li></ul></div>
  21. <div class="paragraph"><p>See also:</p></div>
  22. <div class="ulist"><ul><li><p><a href="http://netbeans.org/kb/docs/ide/subversion.html">Source Code Management with Subversion</a></p></li></ul></div></div></div></div><div id="footer"><div id="footer-text">Version <br>Last updated 2018-02-28 16:23:40 +00:00</div></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script><script>docsearch({
  23. apiKey: 'a736b6d93de805e26ec2f49b55013fbd',
  24. indexName: 'jmonkeyengine',
  25. inputSelector: '#doc-search',
  26. debug: false // Set debug to true if you want to inspect the dropdown
  27. });</script></body></html>