Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GitWrapper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Georg Seibt
GitWrapper
Commits
c415a922
Commit
c415a922
authored
8 years ago
by
Florian Heck
Browse files
Options
Downloads
Patches
Plain Diff
added docs
parent
d708d439
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/de/uni_passau/fim/seibt/gitwrapper/repo/Branch.java
+14
-0
14 additions, 0 deletions
src/de/uni_passau/fim/seibt/gitwrapper/repo/Branch.java
src/de/uni_passau/fim/seibt/gitwrapper/repo/Reference.java
+10
-3
10 additions, 3 deletions
src/de/uni_passau/fim/seibt/gitwrapper/repo/Reference.java
with
24 additions
and
3 deletions
src/de/uni_passau/fim/seibt/gitwrapper/repo/Branch.java
+
14
−
0
View file @
c415a922
...
...
@@ -11,6 +11,11 @@ public class Branch extends Reference {
super
(
repo
,
name
);
}
/**
* Checks this branch out, and tries to pull changes on this current branch.
*
* @return true if the pull was successful
*/
public
Boolean
pull
()
{
if
(!
repo
.
checkout
(
this
))
{
return
false
;
...
...
@@ -29,11 +34,20 @@ public class Branch extends Reference {
return
fetch
.
map
(
toBoolean
).
orElse
(
false
);
}
/**
* Returns the id of the {@link Commit} this reference is currently pointing to.
*
* @return the id of the {@link Commit} under this branch
*/
@Override
public
String
getId
()
{
return
repo
.
toHash
(
id
).
orElse
(
id
);
}
/**
* Reruns the branch name
* @return the branch name
*/
public
String
getName
()
{
return
id
;
}
...
...
This diff is collapsed.
Click to expand it.
src/de/uni_passau/fim/seibt/gitwrapper/repo/Reference.java
+
10
−
3
View file @
c415a922
...
...
@@ -25,10 +25,10 @@ public abstract class Reference {
}
/**
* Optionally returns the merge base for <code>this</code> and <code>other</code>. The <code>other</code>
commit
* must be part of the same {@link Repository} this {@link
Commit
} is.
* Optionally returns the merge base for <code>this</code> and <code>other</code>. The <code>other</code>
reference
* must be part of the same {@link Repository} this {@link
Reference
} is.
*
* @param other the other {@link
Commit
}
* @param other the other {@link
Reference
}
* @return the merge base or an empty {@link Optional} if there is no merge base or an exception occurred
*/
public
Optional
<
Commit
>
getMergeBase
(
Reference
other
)
{
...
...
@@ -60,6 +60,13 @@ public abstract class Reference {
return
mergeBase
.
map
(
toCommit
);
}
/**
* Performs a merge of <code>this</code> and <code>other</code>. <code>Other</code> must be part of the same
* {@link Repository} this {@link Reference} is.
*
* @param other the {@link Reference} to merge
* @return <code>false</code>, if the merge failed, or contains conflicts.
*/
public
Boolean
merge
(
Reference
other
)
{
Optional
<
ProcessExecutor
.
ExecRes
>
mergeBase
=
git
.
exec
(
repo
.
getDir
(),
"merge"
,
"-n"
,
"-q"
,
other
.
getId
());
Function
<
ProcessExecutor
.
ExecRes
,
Boolean
>
toBoolean
=
res
->
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment