Bug 507360: Example Scripts for EGit integration
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=507360
Change-Id: I6c0bb33c77a3d8ca3d8197567c5f9d55a6b0df2f
Signed-off-by: Max Hohenegger <eclipse@hohenegger.eu>
diff --git a/JavaScript Snippets/Git/checkoutDevelop.js b/JavaScript Snippets/Git/checkoutDevelop.js
new file mode 100644
index 0000000..a1ee709
--- /dev/null
+++ b/JavaScript Snippets/Git/checkoutDevelop.js
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (C) 2016, Max Hohenegger <eclipse@hohenegger.eu>
+ *
+ * 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
+ *******************************************************************************/
+
+// name : Checkout develop
+// popup : enableFor(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)
+// description : Do something with a repository
+loadModule("/System/Platform")
+loadModule('/System/UI')
+
+loadModule("/System/Git UI")
+
+checkoutBranch(getRepository(getSelection()), "develop");
diff --git a/JavaScript Snippets/Git/createBranch.js b/JavaScript Snippets/Git/createBranch.js
new file mode 100644
index 0000000..7980876
--- /dev/null
+++ b/JavaScript Snippets/Git/createBranch.js
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (C) 2016, Max Hohenegger <eclipse@hohenegger.eu>
+ *
+ * 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
+ *******************************************************************************/
+
+// name : Create new branch
+// popup : enableFor(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)
+// description : Do something with a repository
+loadModule("/System/Platform")
+loadModule('/System/UI')
+
+loadModule("/System/Git UI")
+
+createBranch(getRepository(getSelection()));
diff --git a/JavaScript Snippets/Git/deleteBranch.js b/JavaScript Snippets/Git/deleteBranch.js
new file mode 100644
index 0000000..ae38a59
--- /dev/null
+++ b/JavaScript Snippets/Git/deleteBranch.js
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (C) 2016, Max Hohenegger <eclipse@hohenegger.eu>
+ *
+ * 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
+ *******************************************************************************/
+
+// name : Delete Branch
+// popup : enableFor(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)
+// description : Do something with a repository
+loadModule("/System/Platform")
+loadModule('/System/UI')
+
+loadModule("/System/Git UI")
+
+deleteBranch(getRepository(getSelection()));
diff --git a/JavaScript Snippets/Git/handleUncommittedChanges.js b/JavaScript Snippets/Git/handleUncommittedChanges.js
new file mode 100644
index 0000000..8a25e47
--- /dev/null
+++ b/JavaScript Snippets/Git/handleUncommittedChanges.js
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (C) 2016, Max Hohenegger <eclipse@hohenegger.eu>
+ *
+ * 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
+ *******************************************************************************/
+
+// name : Handle uncommitted changes
+// popup : enableFor(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)
+// description : Do something with a repository
+loadModule("/System/Platform")
+loadModule('/System/UI')
+
+loadModule("/System/Git UI")
+
+handleUncommittedFiles(getRepository(getSelection()));
diff --git a/JavaScript Snippets/Git/mergeDevelop.js b/JavaScript Snippets/Git/mergeDevelop.js
new file mode 100644
index 0000000..78d68da
--- /dev/null
+++ b/JavaScript Snippets/Git/mergeDevelop.js
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (C) 2016, Max Hohenegger <eclipse@hohenegger.eu>
+ *
+ * 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
+ *******************************************************************************/
+
+// name : Merge develop
+// popup : enableFor(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)
+// description : Do something with a repository
+loadModule("/System/Platform")
+loadModule('/System/UI')
+
+loadModule("/System/Git UI")
+
+mergeFrom(getRepository(getSelection()), "develop");
diff --git a/JavaScript Snippets/Git/rebase.js b/JavaScript Snippets/Git/rebase.js
new file mode 100644
index 0000000..49d92a5
--- /dev/null
+++ b/JavaScript Snippets/Git/rebase.js
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (C) 2016, Max Hohenegger <eclipse@hohenegger.eu>
+ *
+ * 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
+ *******************************************************************************/
+
+// name : Rebase on develop
+// toolbar : Git Repositories
+// popup : enableFor(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)
+// description : Do something with a repository
+loadModule("/System/Platform")
+loadModule('/System/UI')
+
+loadModule("/System/Git UI")
+
+rebaseOn(getRepository(getSelection()), "develop");
diff --git a/JavaScript Snippets/Git/renameBranch.js b/JavaScript Snippets/Git/renameBranch.js
new file mode 100644
index 0000000..940b769
--- /dev/null
+++ b/JavaScript Snippets/Git/renameBranch.js
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (C) 2016, Max Hohenegger <eclipse@hohenegger.eu>
+ *
+ * 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
+ *******************************************************************************/
+
+// name : Rename Branch
+// popup : enableFor(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)
+// description : Do something with a repository
+loadModule("/System/Platform")
+loadModule('/System/UI')
+
+loadModule("/System/Git UI")
+
+renameBranch(getRepository(getSelection()));
diff --git a/JavaScript Snippets/Git/resetHard.js b/JavaScript Snippets/Git/resetHard.js
new file mode 100644
index 0000000..0af079e
--- /dev/null
+++ b/JavaScript Snippets/Git/resetHard.js
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (C) 2016, Max Hohenegger <eclipse@hohenegger.eu>
+ *
+ * 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
+ *******************************************************************************/
+
+// name : Reset to previous commit
+// popup : enableFor(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)
+// description : Do something with a repository
+loadModule("/System/Platform")
+loadModule('/System/UI')
+
+loadModule("/System/Git UI")
+
+resetToOriginHead(getRepository(getSelection()), 1);