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
a32012a0
Commit
a32012a0
authored
8 years ago
by
Georg Seibt
Browse files
Options
Downloads
Patches
Plain Diff
use the actual Commit object instead of its id in the Status, small doc fixes
parent
e4851a80
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/de/uni_passau/fim/seibt/gitwrapper/repo/Status.java
+12
-9
12 additions, 9 deletions
src/de/uni_passau/fim/seibt/gitwrapper/repo/Status.java
with
12 additions
and
9 deletions
src/de/uni_passau/fim/seibt/gitwrapper/repo/Status.java
+
12
−
9
View file @
a32012a0
package
de.uni_passau.fim.seibt.gitwrapper.repo
;
import
java.io.StringWriter
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.Collections
;
...
...
@@ -21,10 +22,10 @@ public class Status {
/**
* The commit, this {@link Status} is based on.
*/
public
final
String
id
;
public
final
Commit
commit
;
/**
* A map of files which were changed since the last
commit (with id
{@link #
id})
and their status codes.
* A map of files which were changed since the last {@link #
commit}
and their status codes.
*/
public
final
Map
<
Path
,
String
>
changed
;
...
...
@@ -34,18 +35,20 @@ public class Status {
public
final
Map
<
Path
,
String
>
unmerged
;
/**
* @param id the commit id
* Constructs a new {@link Status}.
*
* @param commit the current HEAD {@link Commit} at the time this {@link Status} is constructed
* @param changed a map of changed files and heir status codes
* @param unmerged a map of unmerged files an their status code.
*/
private
Status
(
String
id
,
Map
<
Path
,
String
>
changed
,
Map
<
Path
,
String
>
unmerged
)
{
this
.
id
=
id
;
private
Status
(
Commit
commit
,
Map
<
Path
,
String
>
changed
,
Map
<
Path
,
String
>
unmerged
)
{
this
.
commit
=
commit
;
this
.
changed
=
Collections
.
unmodifiableMap
(
changed
);
this
.
unmerged
=
Collections
.
unmodifiableMap
(
unmerged
);
}
/**
*
Checks, if <code>this</code>
represents a clean repository.
*
Returns whether this {@link Status}
represents a clean repository.
*
* @return <code>true</code>, if the repository state is clean and has uncommitted changes.
*/
...
...
@@ -54,7 +57,7 @@ public class Status {
}
/**
*
Checks, if <code>this</code>
has unmerged files.
*
Returns whether this {@link Status}
has unmerged files.
*
* @return <code>true</code>, if there are unmerged files
*/
...
...
@@ -66,7 +69,7 @@ public class Status {
public
String
toString
()
{
String
out
=
""
;
if
(
isClean
())
{
out
=
"Clean working directory on commit "
+
id
+
"\n"
;
out
=
"Clean working directory on commit "
+
commit
+
"\n"
;
}
else
{
if
(!
unmerged
.
isEmpty
())
{
out
=
"Unmerged files:"
;
...
...
@@ -105,6 +108,6 @@ public class Status {
}
}
return
repo
.
getCurrentHEAD
().
map
(
head
->
new
Status
(
head
.
id
,
changed
,
unmerged
));
return
repo
.
getCurrentHEAD
().
map
(
head
->
new
Status
(
head
,
changed
,
unmerged
));
}
}
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