Skip to content
Snippets Groups Projects
Commit 4adb3d17 authored by atharmasanthiran's avatar atharmasanthiran
Browse files

Bug 532956: Added an example to show complete git workflow.

This example shows how to use the methods in the Git module in order to
automatically clone a
remote repository, importing it into the workspace, adding a sample text
file and then finally add, commit and push back to the remote
repository.

Task-Url:https://bugs.eclipse.org/bugs/show_bug.cgi?id=532956



Change-Id: I2b1de182804bc807153a2b219f607078306f1fed
Signed-off-by: default avataratharmasanthiran <aathmant.16@cse.mrt.ac.lk>
parent 4c667713
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Git Example Script</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
/*******************************************************************************
* Copyright (c) 2018 Aathman Tharmasanthiran and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: Aathman Tharmasanthiran - initial API and implementation
******************************************************************************/
loadModule('/System/Git');
loadModule('/System/Resources');
var localRepo = "C:/New folder";
var remoteRepo = "https://github.com/AathmanT/Example-codes.git";
var username = "";
var password = "";
var gitRepo = clone(remoteRepo, localRepo, username, password);
var projectFileLocations = findFiles("*.project", localRepo, true);
for (var i = 0; i < (projectFileLocations.length); i++) {
linkProject((projectFileLocations[i]).getParent());
}
var fileHandle = writeFile(localRepo + "/Test file.txt",
"This is the test file added to test commit.");
fileHandle.close();
add(localRepo, "Test file.txt");
commit(localRepo, "Added a test file", "AathmanT aathmant@gmail.com");
push(localRepo);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment