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

From Eclipsepedia

< Orion‎ | How Tos
Jump to: navigation, search
m (screen shots)
(category sort)
 
(31 intermediate revisions by 5 users not shown)
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  =
  
A) These are steps to link a Git repository from a separate server:
+
#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]...)
# 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]]
+
#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.
# In the 'Link Folder' dialog enter the folder name and choose gitfs in the combo
+
#Orion will automatically detect that the project is actually a Git clone (we will probably make it configurable in the future)
# As the location use url like <code>git://github.com/<your name>/<repository>.git</code>, leave the Module field empty
+
[[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].
+
= Cloning a Git repository =
  
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.
+
{{warning|Work in progress|This scenario has not been fully implemented yet.}}
# 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]).
+
# 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>).
+
# Enter <code>git init --bare</code>
+
# Now you can follow steps from A, but for the URL enter <code>c:/temp/git-repo</code>
+
  
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:
+
For detailed instruction how to clone repository from GitHub view [[Orion/How Tos/Cloning repository from github]]
# 1, 2, 3 as in B.
+
# 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.
+
#[[Orion/How Tos/Install Orion on Localhost#Downloading_and_Running_Orion_on_Localhost|Download and run Orion]]
 +
#Click the '''Repositories''' link to go to the Git Clones viewer.<br><br>[[Image:Orion Repostories link.png‎]]<br><br>
 +
#Select the Git Clone action.<br><br>[[Image:Git clone action.png]]<br><br>
 +
#Enter the Git repository URL, and click '''OK'''.<br><br>[[Image:Clone_git_repository_dialog.png]]<br><br>
 +
#The repository will be cloned to a default location in your workspace. If you want to change target location click "Choose target location" and input the new project name or select a directory that already exists in your workspace.<br><br>[[Image:Clone_git_repository_dialog_advanced.png]]
 +
#If authentication is needed you will be prompted for credentials. Which fields are required depends on the specific repository you're connecting to.<br><br>[[Image:Git clone dialog.png]]<br><br>
 +
#When cloning is finished, you'll see the new clone appear in the list:<br><br>[[Image:Git_clone_complete.png]]<br><br>
 +
#Done! You may use the Repositories view to browse remotes and branches of your repository or click the main repository link to view repository contents.<br><br>[[Image:Git_clone_repo_view.png]]<br>
 +
 
 +
= Using Orion Compare Viewer =
 +
{{warning|Work in progress|This scenario has not been fully implemented yet.}}
 +
Although still in progress , you can now use both in-line and side-by-side compare viewer from Orion.Currently you have to use the viewer HTML directly in your browser and use your file location as the hash of the html. Please also note that the compare viewer container UI will be changed later to fit better layout.
 +
# [[Orion/How_Tos/Install_Orion_on_Localhost#Downloading_and_Running_Orion_on_Localhost|Download and run Orion]] or pull the latest code on both server and client side.
 +
# Link a folder to your  git repository.
 +
# Open a file in the folder by Orion Editor.
 +
# Change something and save the changes.
 +
# Copy the "#/file/your_project/your_file" part from the editor URL as the file location.
 +
# Paste it as the hash value of the viewer HTML(/js/compare/demo/demo-inline.html and /js/compare/demo/demo.html)
 +
# Below are the format and examples.
 +
* In-line  viewer :
 +
http://Your_server:8080/js/compare/demo/demo-inline.html#/file/your_project/your_file
 +
( e.g.  http://localhost:8080/js/compare/demo/demo-inline.html#/file/K/bundles/org.eclipse.orion.client.core/static/js/compare/demo/demo-inline.html)<br>[[Image:Howtogit--in-line-viewer.png]]
 +
* Side-by-side viewer(as planned , this viewer will become the merge editor):
 +
http://Your_server:8080/js/compare/demo/demo.html#/file/your_project/your_file
 +
( e.g.  http://localhost:8080/js/compare/demo/demo.html#/file/K/bundles/org.eclipse.orion.client.core/static/js/compare/demo/demo-inline.html)<br>[[Image:Howtogit--side-by-side-viewer1.png]]
 +
 
 +
= Using Orion Git Status Page =
 +
{{warning|Work in progress|This scenario has not been fully implemented yet.}}
 +
Please note that the section is currently used for developer's discussion.The UI shown below is the developer's UI mockup. The functionality is addressed in a high level.
 +
 
 +
[[Image:Howtogit--git-status_new.png]]
 +
# Similiar to the compare viewer , the URL format of the git status page is : http://localhost:8080/git-status.html#/file/K/bundles/org.eclipse.orion.client.core/static/js/compare/.<br>Here you pass the directory path to the html.The page will show you the git status under that directory.
 +
# There will be an action somewhere in the navigator to open this page so that user does not have to input the directory as the hash.
 +
# On the left hand , all the unstaged and staged changes are listed up in two areas.
 +
# Clicking on any line will high-light it and the right hand side viewer will show the difference of that file against the Git repo.
 +
# On the unstaged area , hovering on any line pops up two action buttons : compare and stage. The compare action navigates user to a side by side compare viewer. The stage action will stage the file represented by the line.
 +
# On the staged area , hovering on any line pops up two action buttons : compare and unstage. The compare action navigates user to a side by side compare viewer. The unstage action will unstage the file represented by the line.
 +
# The side by side viewer is planned to be upgraded to a compare merge editor post M6.
 +
 
 +
= Git REST API =
 +
 
 +
This section was moved to [[Orion/Server_API/Git_API]].
 +
 
 +
= 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|How To]]
 +
[[Category:Orion/How_To|Git]]

Latest revision as of 13:20, 23 June 2011

Contents

[edit] 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)

[edit] Cloning a Git repository

Warning2.png
Work in progress
This scenario has not been fully implemented yet.


For detailed instruction how to clone repository from GitHub view Orion/How Tos/Cloning repository from github

  1. Download and run Orion
  2. Click the Repositories link to go to the Git Clones viewer.

    Orion Repostories link.png

  3. Select the Git Clone action.

    Git clone action.png

  4. Enter the Git repository URL, and click OK.

    Clone git repository dialog.png

  5. The repository will be cloned to a default location in your workspace. If you want to change target location click "Choose target location" and input the new project name or select a directory that already exists in your workspace.

    Clone git repository dialog advanced.png
  6. If authentication is needed you will be prompted for credentials. Which fields are required depends on the specific repository you're connecting to.

    Git clone dialog.png

  7. When cloning is finished, you'll see the new clone appear in the list:

    Git clone complete.png

  8. Done! You may use the Repositories view to browse remotes and branches of your repository or click the main repository link to view repository contents.

    Git clone repo view.png

[edit] Using Orion Compare Viewer

Warning2.png
Work in progress
This scenario has not been fully implemented yet.

Although still in progress , you can now use both in-line and side-by-side compare viewer from Orion.Currently you have to use the viewer HTML directly in your browser and use your file location as the hash of the html. Please also note that the compare viewer container UI will be changed later to fit better layout.

  1. Download and run Orion or pull the latest code on both server and client side.
  2. Link a folder to your git repository.
  3. Open a file in the folder by Orion Editor.
  4. Change something and save the changes.
  5. Copy the "#/file/your_project/your_file" part from the editor URL as the file location.
  6. Paste it as the hash value of the viewer HTML(/js/compare/demo/demo-inline.html and /js/compare/demo/demo.html)
  7. Below are the format and examples.
  • In-line viewer :
http://Your_server:8080/js/compare/demo/demo-inline.html#/file/your_project/your_file
( e.g.  http://localhost:8080/js/compare/demo/demo-inline.html#/file/K/bundles/org.eclipse.orion.client.core/static/js/compare/demo/demo-inline.html)
Howtogit--in-line-viewer.png
  • Side-by-side viewer(as planned , this viewer will become the merge editor):
http://Your_server:8080/js/compare/demo/demo.html#/file/your_project/your_file
( e.g.  http://localhost:8080/js/compare/demo/demo.html#/file/K/bundles/org.eclipse.orion.client.core/static/js/compare/demo/demo-inline.html)
Howtogit--side-by-side-viewer1.png

[edit] Using Orion Git Status Page

Warning2.png
Work in progress
This scenario has not been fully implemented yet.

Please note that the section is currently used for developer's discussion.The UI shown below is the developer's UI mockup. The functionality is addressed in a high level.

Howtogit--git-status new.png

  1. Similiar to the compare viewer , the URL format of the git status page is : http://localhost:8080/git-status.html#/file/K/bundles/org.eclipse.orion.client.core/static/js/compare/.
    Here you pass the directory path to the html.The page will show you the git status under that directory.
  2. There will be an action somewhere in the navigator to open this page so that user does not have to input the directory as the hash.
  3. On the left hand , all the unstaged and staged changes are listed up in two areas.
  4. Clicking on any line will high-light it and the right hand side viewer will show the difference of that file against the Git repo.
  5. On the unstaged area , hovering on any line pops up two action buttons : compare and stage. The compare action navigates user to a side by side compare viewer. The stage action will stage the file represented by the line.
  6. On the staged area , hovering on any line pops up two action buttons : compare and unstage. The compare action navigates user to a side by side compare viewer. The unstage action will unstage the file represented by the line.
  7. The side by side viewer is planned to be upgraded to a compare merge editor post M6.

[edit] Git REST API

This section was moved to Orion/Server_API/Git_API.

[edit] 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.