Difference between revisions of "Orion/How Tos/Working with git"

From Eclipsepedia

< Orion‎ | How Tos
Jump to: navigation, search
(Categories)
(working on bug 337212)
Line 1: Line 1:
First of all, to make Git file store available, you need to add <code>org.eclipse.orion.server.filesystem.git</code> and all dependencies to your launch configuration. If you're missing a dependency you should probably re-import project set from webide.psf. If it didn't help, ping z4z4 on [[IRC]] (use #eclipse-orion channel).
+
= Linking to a git clone already existing on your computer  =
 +
# First [[http://www.kernel.org/pub/software/scm/git/docs/git-clone.html clone]] a git repository to any location in your local filesystem, you can do with a tool of your choice ([[EGit]], [http://code.google.com/p/msysgit/downloads/list msysgit]...)
 +
# [[Orion/How_Tos/Install_Orion_on_Localhost#Downloading_and_Running_Orion_on_Localhost|Download and run Orion]]
 +
# Create a project and [[Orion/How_Tos/Install_Orion_on_Localhost#Linking_to_existing_content|link it]] to the location you used in Step 1.
 +
# Orion will automatically detect that the project is actually a git clone (we will probably make it configurable in the future)
  
A) These are steps to link a Git repository from a separate server:
+
= Linking to a git repository using git file store =
# Start EclipseWeb server, go to http://localhost:8080/navigate-table.html# and log in
+
# [[Orion/How_Tos/Install_Orion_on_Localhost#Downloading_and_Running_Orion_on_Localhost|Download and run Orion]]
# Choose 'Link folder' [[Image:Howtogit--link_folder.png]]
+
# Make sure <code>org.eclipse.orion.server.filesystem.git</code> is added your launch configuration
# In the 'Link Folder' dialog enter the folder name and choose gitfs in the combo
+
# When [[Orion/How_Tos/Install_Orion_on_Localhost#Linking_to_existing_content|linking]] a project select <code>gitfs</code>, enter URL for a git repository and leave Module empty
# As the location use url like <code>git://github.com/<your name>/<repository>.git</code>, leave the Module field empty
+
# If you entered an existing location on your computer it must be a cloned repository, we won't be doing any smart detection here [[Image:Howtogit--link folder dialog2.png]]
[[Image:Howtogit--link_folder_dialog.png]]
+
# For a git repository which requires authentication (e.g. starts with ssh://) to be able to clone it (and also fetch and push) you will need to wait for [https://bugs.eclipse.org/bugs/show_bug.cgi?id=334120 bug 334120] to be fixed [[Image:Howtogit--link folder dialog.png]]
  
Orion will create a local clone of the repository and store it on the server. The user will be not aware of the local clone, so the git repository location specified by the user is the only copy of the code the user knows about. His changes will be saved in the file system on the server and then automatically added to the git index and comitted to the local repository/clone. The local clone is required by the git client if we want to push the changes back to the external git repository (eg. located on github.com). Each user will have his own copy (local clone) of the remote git repository once he created/linked a new project (separate folder on the server). The problem is that we currently don't know [https://bugs.eclipse.org/bugs/show_bug.cgi?id=334120 how to push Git changes over SSH without storing a private key on the Orion server].
+
= git REST API =
 +
== Getting status for a git project ==
  
B) You may also create a local bare Git repository and share it among multiple Orion users. In this case changes are pushed to the shared repository and users may share their work.
+
{{Orion/ServerAPI
# To create a repository you'll need a git client like msysgit (I'm using PortableGit downloaded from [http://code.google.com/p/msysgit/downloads/list here]).
+
| method = GET
# When in the git console go to a location on your disk where you want the repository to be created (e.g. <code>c:/temp/git-repo</code>).
+
| overview = To retrieve the working tree status of a project, send a GET request to the git status location.
# Enter <code>git init --bare</code>
+
| reqhead = /git/status/file/MyProj/
# Now you can follow steps from A, but for the URL enter <code>c:/temp/git-repo</code>
+
| resphead = 200 OK
 +
  Content-Type: text/plain
 +
  Content-Length: 22
 +
| respbody = 
 +
  TBD
 +
| explain = TBD.
 +
}}
  
C) Another option is to clone an existing repository, but make it bare while doing so. This way you can check out a project from GitHub and share your work with others at the same time. You won't be able to push your changes back to the GitHub though (see [https://bugs.eclipse.org/bugs/show_bug.cgi?id=334120 bug 334120] and the problem described above). Anyway, here are the steps for sharing an external repo:
+
Progress in being tracked on [https://bugs.eclipse.org/bugs/show_bug.cgi?id=337212 bug 337212].
# 1, 2, 3 as in B.
+
This section will be moved to [[Orion/Server_API]] once the API get stable.
# Enter <code>git clone --bare git://github.com/zaza/test.git git-repo</code>
+
# Just like in B, you can now follow steps from A and use local filesystem location as the URL (e.g. <code>c:/temp/git-repo</code>)
+
[[Image:Howtogit--link_folder_dialog2.png]]
+
+
I guess you can init a bare repository using EGit as well, but I'm still feeling more comfortable with a CLI.
+
  
If you experience any problems when following the steps above ping z4z4, or [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=e4&component=Orion&version=0.2 open a new bug] right away.
+
== Getting a diff ==
  
[[Category:Orion]]
+
{{Orion/ServerAPI
[[Category:Orion/How To]]
+
| method = GET
 +
| overview = To retrieve changes changes between selected commits, commit and working tree, and so on. Send a GET request to the git diff location.
 +
| reqhead = /git/diff/file/MyProj/
 +
| resphead = 200 OK
 +
  Content-Type: text/plain
 +
  Content-Length: 22
 +
| respbody = 
 +
  TBD
 +
| explain = TBD.
 +
}}
 +
 
 +
Progress in being tracked on [https://bugs.eclipse.org/bugs/show_bug.cgi?id=337212 bug 337212].
 +
This section will be moved to [[Orion/Server_API]] once the API get stable.
 +
 
 +
== Other operations ==
 +
TBD, see [https://bugs.eclipse.org/bugs/show_bug.cgi?id=336116 bug 336116]
 +
 
 +
= Bugs, comments, feedback =
 +
If you experience any problems when following the steps above ping z4z4 or SzymonB on [[IRC]] (use #eclipse-orion channel)., or [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=e4&component=Orion&version=0.2 open a new bug] right away.
 +
 
 +
 
 +
[[Category:Orion]] [[Category:Orion/How_To]]

Revision as of 06:45, 16 February 2011

Contents

Linking to a git clone already existing on your computer

  1. First [clone] a git repository to any location in your local filesystem, you can do with a tool of your choice (EGit, msysgit...)
  2. Download and run Orion
  3. Create a project and link it to the location you used in Step 1.
  4. Orion will automatically detect that the project is actually a git clone (we will probably make it configurable in the future)

Linking to a git repository using git file store

  1. Download and run Orion
  2. Make sure org.eclipse.orion.server.filesystem.git is added your launch configuration
  3. When linking a project select gitfs, enter URL for a git repository and leave Module empty
  4. If you entered an existing location on your computer it must be a cloned repository, we won't be doing any smart detection here Howtogit--link folder dialog2.png
  5. For a git repository which requires authentication (e.g. starts with ssh://) to be able to clone it (and also fetch and push) you will need to wait for bug 334120 to be fixed Howtogit--link folder dialog.png

git REST API

Getting status for a git project

Overview
To retrieve the working tree status of a project, send a GET request to the git status location.
HTTP Method
GET
Example Request
GET /git/status/file/MyProj/

  
Example Response
HTTP/1.1 200 OK
 Content-Type: text/plain
 Content-Length: 22

TBD
Detailed Explanation
TBD.


Progress in being tracked on bug 337212. This section will be moved to Orion/Server_API once the API get stable.

Getting a diff

Overview
To retrieve changes changes between selected commits, commit and working tree, and so on. Send a GET request to the git diff location.
HTTP Method
GET
Example Request
GET /git/diff/file/MyProj/

  
Example Response
HTTP/1.1 200 OK
 Content-Type: text/plain
 Content-Length: 22

TBD
Detailed Explanation
TBD.


Progress in being tracked on bug 337212. This section will be moved to Orion/Server_API once the API get stable.

Other operations

TBD, see bug 336116

Bugs, comments, feedback

If you experience any problems when following the steps above ping z4z4 or SzymonB on IRC (use #eclipse-orion channel)., or open a new bug right away.