This revision made November 07, 2012 19:12, by nvause
« earlier revision revert to this « later revision

» Project Kenai Documentation and Training     » How Do I ...

Source Code Management

When a project administrator chooses a Subversion, Mercurial, or Git repository for your project, as described at Managing a Project: Source Code Repository, a source code management repository is set up and hosted here that works with this site's Subversion, Mercurial, or Git server software.

Note: If your project uses an external repository, none of the information on this page applies.

For example, for a project named bluebird with a subversion repository named subversion, here's the URL for https access:

 https://kenai.com/svn/bluebird~subversion

Here's the URL for SSH access:

 svn+ssh://your-username@svn.kenai.com/bluebird~subversion


Here's where the read-only Mercurial repository would be:

 https://kenai.com/hg/bluebird~mercurial

For read/write access to your Mercurial repository, use the Secure Shell Protocol, or SSH, and the ssh prefix. For example:

 ssh://your-user-name@hg.kenai.com/bluebird~mercurial


Here's where the read-only Git repository would be:

 git://kenai.com/bluebird~git-code-repository

Note: The git prefix uses a custom service called git-daemon to provide read-only public access to repositories. For read/write access, you must use the Secure Shell Protocol, or SSH, and the ssh prefix. For example

 ssh://your-user-name@git.kenai.com/bluebird~git-code-repository

To check files out of and into one of these repositories, you have to install the corresponding client software on your local machine, as described below in Overview: Checking Files Into and Out of a Repository.

Note: The project administrator can add more repositories to a project on its Manage page. (On the project's home page, click Manage This Project.) See Managing a Project: Source Code Repository for more information.


Viewing Source Repository Information

To see where your project's source code repository is, open the project page and click the repository link on the left under Source Code Repository.

Overview: Checking Files Into and Out of a Repository

To check files into and out of the repository, you have to download the Subversion client, the Mercurial client, or the Git client and install it on your local system.

In general, here's what you do for Subversion to initially get your code into your repository:

  1. Install the corresponding source code management client on your local system.
  2. Create a directory on your local machine for the local repository.
  3. Check out the empty repository from the server to your local repository.
  4. Add directories and files to the local repository.
  5. Check the files into your repository on the server.

For Mercurial and Git, the process is a little different:

  1. Set up an SSH key pair and add the public key to your user profile.
  2. Create a local working repository.
  3. Add your kenai.com repository as a remote repository, using the ssh syntax.
  4. In your local working repository, create or import the source code to be checked in.
  5. Mark the new files to be added.
  6. Commit the new files to the local repository.
  7. Push the changes to your kenai.com repository.

After you have some code in the repository, you can use your browser to view the code. See Browsing Source Repositories below for more information.

About Subversion

Subversion is a centralized version control system initially designed to be a suitable replacement for the Concurrent Versions System (CVS). It has long since surpassed CVS in functionality and extensibility. It's available for free either as source code that you compile or as a binary package that's ready to install. See http://subversion.tigris.org for more information on getting the Subversion client and installing it on your local system.

Accessing a Subversion Repository

Once you have Subversion installed on your local system, you can check out code and check it back into your project repository. The following instructions should get you started.

For full instructions on using Subversion, see http://svnbook.red-bean.com/.

About Mercurial

Mercurial is a distributed revision control system that is designed to be fast and lightweight. It has a command structure similar to Subversion's. You can download the Mercurial client for installation on your local machine either as a binary package or as source code that you build yourself.

Accessing a Mercurial Repository

Once you have Mercurial installed on your local system, you can check out code and check it back into your project repository. The following instructions should get you started.

For full instructions on using Mercurial, see http://hgbook.red-bean.com/.

About Git

Git is a distributed revision control system that was originally built for use by the Linux kernel developers. Its feature set is similar to that of Mercurial, with the addition of fast local branching. Like Subversion, it is available as open source for most popular operating systems. You can download the Git client at http://git-scm.com/download.

Accessing a Git Repository

Once you have Git installed on your local system, you can check out code and check it back into your project repository. The following instructions should get you started.

  1. Before you can work with Git, you need to add a public SSH key to your site profile as described in Generating An SSH Key.
  2. Open your Kenai project's Git repository page (as described above under Viewing Source Repository Information) and copy the SSH URL to your clipboard.
  3. On your local system, open a terminal window on Linux or Mac or run the Git program on Windows, which opens a Git terminal window for you.
  4. In your terminal window, run the following series of commands to create a new repository directory, initialize a local repository in that directory, and connect the Kenai server repository to it:
    mkdir new-repo
    cd new-repo/
    git init
    git remote add origin ssh://your-user-name@git.kenai.com/your-project-name~git-code-repository
    Note: You need to paste in your own ssh path to the last command above.

After this series of steps, you can use the local Git repository to check code in and out and push and pull revisions to and from the remote Kenai repository.

For example, you can create a local file called hello.txt and add and commit it to your local repository, then push the changes to your project's Kenai repository by using the following sequence of commands in a terminal or Git window:

 $ git add hello.txt
 $ git commit hello.txt -m"First commit of new file hello.txt"
 $ git push origin master

After a successful push, the changes are reflected in the source code browser for your project on Kenai.com. Any other clones of the repository will be able to see them as well after you git pull the latest revision.

Browsing Source Repositories

Project Kenai not only enables you to do source code management, but lets you browse your repositories with your web browser. To browse a project's repository, you first display the project page, then click Get Source Code and click Browse in the popup, as shown below.

Note: You can limit who can browse your source code by setting role permissions for the Check Out action. For more information, see Managing a Project: Source Code Repository.

      
Note: If you see a screen like the following one, the repository is empty. Follow the instructions above for your type of source control management system to add files to the repository.

      

After clicking Browse, you see a list of the project's repository's files and folders. Click files to see them or click folders to open them. You can use the dark blue path (below the light blue area that shows the revision number) to keep track of where you are in the tree. You can click any folder in that path to navigate back up the tree.

For example, the following screen shot shows the createPkg1.html file open in the sourceUI folder. The path is above File Revision History.

With a file displayed, here are some of the things you can do:

Determining the File Revision Number

You see the revision number at the top left of the light blue region. In the image above, the revision number is 34.

Seeing File Revision History

Click File Revision History on the left under the path and above the file size. (See above figure.)

Getting a Copy of the File

To get a copy of the file that you can save on your local machine:

  1. Click Get Raw File to the right of File Revision History. (See above figure.)
  2. In the browser dialog box, save the file.

Viewing Diffs of Two File Revisions

A diff is a view of both files showing the changes (differences).

To see a diff between two revisions:

  1. Display the file and click File Revision History to determine which revisions you want to see.
  2. Click the browser's Back button to go back to the previous screen that shows the file.
  3. In the fields to the right of the Get diffs button, enter the two revision numbers you want to compare, then click Get diffs, as shown in the figure below.

Seeing Project Revision History

Click Project Revision History in the top right part of the blue area. (See above figure.)

Getting a File's Checkout URL

  1. Click Checkout URL in the right part of the blue area under Project Revision History.
  2. Select and copy the URL from the popup and use it in your source control client, as shown in the following figure.
Difference compared to previous revision
<span><span style="text-decoration:underline;color:green">[[Home | &raquo; Project Kenai Documentation and Training]] &nbsp; &nbsp; [[Howdoi | &raquo; How Do I ...]] <h1>Source Code Management</h1> When a project administrator chooses a Subversion, Mercurial, or Git repository for your project, as described at [[ManageProject#Source_Code_Repository|Managing a Project: Source Code Repository]], a source code management repository is set up and hosted here that works with this site's Subversion, Mercurial, or Git server software. '''''Note:''''' ''If your project uses an external repository, none of the information on this page applies.'' For example, for a project named ''bluebird'' with a subversion repository named ''subversion'', here's the URL for https access: <nowiki>https://kenai.com/svn/bluebird~subversion</nowiki> Here's the URL for SSH access: <tt><nowiki>svn+ssh://</nowiki></tt>''your-username''<tt>@svn.kenai.com/bluebird~subversion</tt> Here's where the read-only Mercurial repository would be: <nowiki>https://kenai.com/hg/bluebird~mercurial</nowiki> For read/write access to your Mercurial repository, use the Secure Shell Protocol, or SSH, and the ssh prefix. For example: <nowiki>ssh://</nowiki>''your-user-name''<nowiki>@hg.kenai.com/bluebird~mercurial</nowiki> Here's where the read-only Git repository would be: <nowiki>git://kenai.com/bluebird~git-code-repository</nowiki> '''Note:''' The git prefix uses a custom service called ''git-daemon'' to provide read-only public access to repositories. For read/write access, you must use the Secure Shell Protocol, or SSH, and the ssh prefix. For example<br/> <tt><nowiki>ssh://</nowiki>''your-user-name''<nowiki>@git.kenai.com/bluebird~git-code-repository</nowiki></tt> To check files out of and into one of these repositories, you have to install the corresponding client software on your local machine, as described below in [[#overview|Overview: Checking Files Into and Out of a Repository]]. '''Note:''' The project administrator can add more repositories to a project on its Manage page. (On the project's home page, click Manage This Project.) See [[ManageProject#Source_Code_Repository|Managing a Project: Source Code Repository]] for more information. <br /> __TOC__ </span>==<span style="text-decoration:underline;color:green">Viewing Source Repository Information== To see where your project's source code repository is, open the project page and click the repository link on the left under Source Code Repository. [[image:selectrepos.png]] <span id="overview"></span> ==Overview: Checking Files Into and Out of a Repository== To check files into and out of the repository, you have to download the [[#About_Subversion|Subversion client]], the [[#About_Mercurial|Mercurial client]], or the [[#About_Git|Git client]] and install it on your local system. In general, here's what you do for Subversion to initially get your code into your repository: # Install the corresponding source code management client on your local system. # Create a directory on your local machine for the local repository. # Check out the empty repository from the server to your local repository. # Add directories and files to the local repository. # Check the files into your repository on the server. For Mercurial and Git, the process is a little different: # Set up an [[GeneratingAnSSHKey|SSH key pair]] and add the public key to your user profile. # Create a local working repository. # Add your kenai.com repository as a remote repository, using the ssh syntax. # In your local working repository, create or import the source code to be checked in. # Mark the new files to be added. # Commit the new files to the local repository. # Push the changes to your kenai.com repository. After you have some code in the repository, you can use your browser to view the code. See <a href="#browsing">Browsing Source Repositories</a> below for more information. <span id="aboutsvn"></span> ==About Subversion== Subversion is a centralized version control system initially designed to be a suitable replacement for the Concurrent Versions System (CVS). It has long since surpassed CVS in functionality and extensibility. It's available for free either as source code that you compile or as a binary package that's ready to install. See [http://subversion.tigris.org] for more information on getting the Subversion client and installing it on your local system. <span id="usingsvn"></span> ===Accessing a Subversion Repository=== Once you have Subversion installed on your local system, you can check out code and check it back into your project repository. The following instructions should get you started. * [[Usingsvn-unixmac|Using Subversion on UNIX and Mac Systems]] * [[Usingsvn-win|Using Subversion on Microsoft Windows Systems]] For full instructions on using Subversion, see [http://svnbook.red-bean.com/]. <span id="abouthg"></span> ==About Mercurial== Mercurial is a distributed revision control system that is designed to be fast and lightweight. It has a command structure similar to Subversion's. You can download the Mercurial client for installation on your local machine either as a [http://www.selenic.com/mercurial/wiki/index.cgi/BinaryPackages binary package] or as [http://www.selenic.com/mercurial/wiki/index.cgi/</span>Do<span style="text-decoration:underline;color:green">wnload sour</span>c<span style="text-decoration:underline;color:green">e code] that yo</span>u<span style="text-decoration:underline;color:green"> build yourself. <span id="usinghg"></span> ===Accessing a Mercurial Repository=== Once you have Mercurial installed on your local syste</span>m<span style="text-decoration:underline;color:green">, you can ch</span>e<span style="text-decoration:underline;color:green">ck out code a</span>n<span style="text-decoration:underline;color:green">d check i</span>t<span style="text-decoration:underline;color:green"> b</span>a<span style="text-decoration:underline;color:green">ck in</span>t<span style="text-decoration:underline;color:green">o your project repos</span>i<span style="text-decoration:underline;color:green">t</span>o<span style="text-decoration:underline;color:green">ry. The followi</span>n<span style="text-decoration:underline;color:green">g</span> <span style="text-decoration:underline;color:green">instructi</span>on<span style="text-decoration:underline;color:green">s</span> <span style="text-decoration:underline;color:green">should get you started. * [[Usinghg-unixmac|Using Mercurial on UNIX and Mac </span>S<span style="text-decoration:underline;color:green">ystems]] * [[Usinghg-win|Using Mercurial </span>o<span style="text-decoration:underline;color:green">n Microsoft Windows Systems]] For f</span>u<span style="text-decoration:underline;color:green">ll inst</span>r<span style="text-decoration:underline;color:green">u</span>c<span style="text-decoration:underline;color:green">tions on using M</span>e<span style="text-decoration:underline;color:green">rcurial,</span> <span style="text-decoration:underline;color:green">see [http://hgbook.red-bean.com/]. <span id="aboutgit"></span> ==About Git== Git is a distributed revision control system that was originally built for use by the Linux kernel developers. Its feature set is similar to that of Mercurial, with the addition of fast local branching. Like Subversion, it is available as open source for most popular operating systems. You can download the Git client at [http://git-scm.com/download]. <span id="usinggit"></span> ===Accessing a Git Repository=== Once you have Git installed on your local system, you can check out code and check it back into your project repository. The following instructions should get you started. # Before you can work with Git, you need to add a public SSH key to your site profile as described in [[GeneratingAnSSHKey|Generating An SSH Key]]. # Open your Kenai project's Git repository page (as described above under [[#Viewing_Source_Repository_Information|Viewing Source Repository Information]]) and copy the SSH URL to your clipboard. # On your local system, open a terminal window on Linux or Mac or run the Git program on Windows, which opens a Git terminal window for you. # In your terminal window, run the following series of commands to create a new repository directory, initialize a local repository in that directory, and connect the Kenai server repository to it:<br/><tt>mkdir new-repo</tt><br/><tt>cd new-repo/</tt><br/><tt>git init</tt><br/><tt>git remote add origin <nowiki>ssh://</nowiki>''your-user-name''<nowiki>@git.kenai.com/</nowiki>''your-project-name''<nowiki>~git-code-repository</nowiki></tt><br/>'''Note:''' You need to paste in your own ssh path to the last command above. After this series of steps, you can use the local Git repository to check code in and out and push and pull revisions to and from the remote Kenai repository. For example, you can create a local file called <tt>hello.txt</tt> and add and commit it to your local repository, then push the changes to your project's Kenai repository by using the following sequence of commands in a terminal or Git window: $ git add hello.txt $ git commit hello.txt -m"First commit of new file hello.txt" $ git push origin master After a successful push, the changes are reflected in the source code browser for your project on Kenai.com. Any other clones of the repository will be able to see them as well after you <tt>git</tt> <tt>pull</tt> the latest revision. <span id="browsing"></span> ==Browsing Source Repositories== Project Kenai not only enables you to do source code management, but lets you browse your repositories with your web browser. To browse a project's repository, you first display the project page, then click Get Source </span>Co<span style="text-decoration:underline;color:green">de a</span>n<span style="text-decoration:underline;color:green">d click Browse in </span>t<span style="text-decoration:underline;color:green">he popup, as shown below. '''Note:''' You can limit who can b</span>ro<span style="text-decoration:underline;color:green">wse your source code by setting ro</span>l<span style="text-decoration:underline;color:green">e</span> <span style="text-decoration:underline;color:green">permissions for the ''Check Out'' action. For more information, see [[Mana</span>g<span style="text-decoration:underline;color:green">ePr</span>o<span style="text-decoration:underline;color:green">j</span>e<span style="text-decoration:underline;color:green">ct#Source_Code_Repo</span>s<span style="text-decoration:underline;color:green">itory|Managing</span> <span style="text-decoration:underline;color:green">a Project: Source Code Repository]]. [[image:browsecoderepos.png]] {|- |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/> |'''Note:''' ''If you see a screen like t</span>he<span style="text-decoration:underline;color:green"> following one, the </span>re<span style="text-decoration:underline;color:green">pository is empty. Follow the instructions [[#overview|above]] for your type of source control management system to add files to the repository.''<br/><br/> [[image:browserepos-nofiles.png]] |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |} After clicking Browse, you see a list of the project's repository's files and folders. Click files to see them or click folders to open them. You can use the dark blue path (below the light blue area that shows the revision number) to keep track of where you are in the tree. You can click any folder in that path to navigate back up the tree. For example, the following screen shot shows the createPkg1.html file open in the sourceUI folder. The path is above ''File Revision History''. [[image:browserepos-viewfile.png]] With a file displayed, here are some of the things you can do: <span id</span>=<span style="text-decoration:underline;color:green">"revisionnum"></span> </span><span style="text-decoration:underline;color:green">==Determining the File Revision Number=== You see the revision number at the top left of the light blue region. In the image above, the revision number is 34. <span id="filerevision"></span> ===Seeing File Revision History=== Click ''File Revision History'' on the left under the path and above the file size. (See above figure.) <span id="getfile"></span> ===Getting a Copy of the File=== To get a copy of the file that you can save on your local machine: # Click ''Get Raw File'' to the right of ''File Revision History''. (See above figure.) # In the browser dialog box, save the file. <span id="diff"></span> ===Viewing Diffs of Two File Revisions=== A ''diff'' is a view of both files showing the changes (differences). To see a diff between two revisions: # Display the file and click ''File Revision History'' to determine which revisions you want to see.<br/>[[image:browserepos-filerev.png]] # Click the browser's Back button to go back to the previous screen that shows the file. # In the fields to the right of the ''Get diffs'' button, enter the two revision numbers you want to compare, then click ''Get diffs'', as shown in the figure below.<br/>[[image:browserepos-getdiffs.png]] <span id="projectrevision"></span> ===Seeing Project Revision History=== Click ''Project Revision History'' in the top right part of the blue area. (See above figure.) <span id="checkouturl"></span> ===Getting a File's Checkout URL=== # Click ''Checkout URL'' in the right part of the blue area under Project Revision History. # Select and copy the URL from the popup and use it in your source control client, as shown in the following figure.<br/>[[image:browserepos-checkouturl.png]]</span><span>

Project Features

Wiki Controls

About this Project

Help for netbeans.org Site Tools was started in November 2009, is owned by kenaiadmin, and has 17 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close