Skip to content

Commit c2ad3fb

Browse files
committed
Remove jgit for now
1 parent af4bfa0 commit c2ad3fb

File tree

9 files changed

+161
-447
lines changed

9 files changed

+161
-447
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# gitpatcher
22
gitpatcher is a Gradle plugin that can manage patches for Git repositories for you ([example]). This is useful if you need a few smaller changes for a Git repository that can't be contributed upstream, but you still easily want to keep up to date with upstream.
3-
gitpatcher manages a local submodule as base, and applies patches from a configurable folder in an extra repository. It runs fully on Java using [jgit].
3+
gitpatcher manages a local submodule as base, and applies patches from a configurable folder in an extra repository. A local Git installation on
4+
the PATH is required for it to run.
45

56
# Installation
67
1. Add a submodule for the project you want to patch.
@@ -33,4 +34,3 @@ gitpatcher manages a local submodule as base, and applies patches from a configu
3334
|`makePatches`|Creates or updates the patches in the patch folder.|
3435

3536
[example]: https://github.com/LapisBlue/Pore/tree/master/patches
36-
[jgit]: https://eclipse.org/jgit/

build.gradle

+1-12
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,14 @@ plugins {
1212
}
1313

1414
group = 'net.minecrell'
15-
version = '0.4.3'
15+
version = '0.5-SNAPSHOT'
1616
description = 'A Gradle plugin to manage patches for Git repositories'
1717

1818
sourceCompatibility = 1.6
1919
targetCompatibility = 1.6
2020

21-
repositories {
22-
jcenter()
23-
}
24-
2521
dependencies {
2622
compile localGroovy()
27-
28-
compile('org.eclipse.jgit:org.eclipse.jgit:3.7.1.201504261725-r') {
29-
// These are included in the Gradle distribution, no need to download them
30-
exclude group: 'com.jcraft', module: 'jsch'
31-
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
32-
exclude group: 'org.slf4j', module: 'slf4j-api'
33-
}
3423
}
3524

3625
license {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
* Copyright (c) 2015, Minecrell <https://github.com/Minecrell>
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
* THE SOFTWARE.
21+
*/
22+
package net.minecrell.gitpatcher
23+
24+
class Git {
25+
26+
File repo
27+
28+
Git(File repo) {
29+
setRepo(repo)
30+
}
31+
32+
void setRepo(File repo) {
33+
this.repo = repo
34+
assert repo.exists()
35+
}
36+
37+
@Override
38+
Command invokeMethod(String name, Object input) {
39+
return new Command(['git', name.replace('_' as char, '-' as char), *input].execute(null as String[], repo))
40+
}
41+
42+
static class Command {
43+
44+
final Process process
45+
46+
private Command(Process process) {
47+
this.process = process;
48+
}
49+
50+
int run() {
51+
def result = process.waitFor()
52+
return result
53+
}
54+
55+
void execute() {
56+
def result = run()
57+
assert result == 0, 'Process returned error code'
58+
}
59+
60+
void setup(OutputStream out, OutputStream err) {
61+
if (out) {
62+
process.consumeProcessOutputStream(out)
63+
}
64+
if (err) {
65+
process.consumeProcessErrorStream(err)
66+
}
67+
}
68+
69+
void writeTo(OutputStream out) {
70+
setup(out, System.err)
71+
execute()
72+
}
73+
74+
void forceWriteTo(OutputStream out) {
75+
setup(out, out)
76+
run()
77+
}
78+
79+
def rightShift = this.&writeTo
80+
def rightShiftUnsigned = this.&forceWriteTo
81+
82+
Object asType(Class type) {
83+
if (type == String) {
84+
setup(null, System.err)
85+
execute()
86+
return process.getInputStream().text
87+
}
88+
}
89+
90+
}
91+
92+
}

src/main/groovy/net/minecrell/gitpatcher/git/MailPatch.groovy

-171
This file was deleted.

src/main/groovy/net/minecrell/gitpatcher/git/Patcher.groovy

-80
This file was deleted.

0 commit comments

Comments
 (0)