summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJens Baumgart2011-11-28 04:46:16 (EST)
committer Jens Baumgart2011-11-28 04:46:16 (EST)
commit99ec987e681c5a21a4a485b778e990e96c52ac51 (patch)
treec07552486f12e1d194d8a8a55b6b3b0db5968aa8
parentb4495d1005e6e03e921ed116614ec45499f1923d (diff)
downloadjgit-99ec987e681c5a21a4a485b778e990e96c52ac51.zip
jgit-99ec987e681c5a21a4a485b778e990e96c52ac51.tar.gz
jgit-99ec987e681c5a21a4a485b778e990e96c52ac51.tar.bz2
RepositoryState: add method canAmendrefs/changes/74/4674/3
The method canAmend was added to RepositoryState. It returns true if amending the HEAD commit is allowed in the current repository state. Change-Id: Idd0c4eea83a23c41340789b7b877959b457d951e Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java
index 1017062..7c8f51d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java
@@ -60,6 +60,7 @@ public enum RepositoryState {
public boolean canCheckout() { return false; }
public boolean canResetHead() { return false; }
public boolean canCommit() { return false; }
+ public boolean canAmend() { return false; }
public String getDescription() { return "Bare"; }
},
@@ -70,6 +71,7 @@ public enum RepositoryState {
public boolean canCheckout() { return true; }
public boolean canResetHead() { return true; }
public boolean canCommit() { return true; }
+ public boolean canAmend() { return true; }
public String getDescription() { return JGitText.get().repositoryState_normal; }
},
@@ -79,6 +81,7 @@ public enum RepositoryState {
public boolean canCheckout() { return false; }
public boolean canResetHead() { return true; }
public boolean canCommit() { return false; }
+ public boolean canAmend() { return false; }
public String getDescription() { return JGitText.get().repositoryState_conflicts; }
},
@@ -90,6 +93,7 @@ public enum RepositoryState {
public boolean canCheckout() { return true; }
public boolean canResetHead() { return true; }
public boolean canCommit() { return true; }
+ public boolean canAmend() { return false; }
public String getDescription() { return JGitText.get().repositoryState_merged; }
},
@@ -99,6 +103,7 @@ public enum RepositoryState {
public boolean canCheckout() { return false; }
public boolean canResetHead() { return true; }
public boolean canCommit() { return false; }
+ public boolean canAmend() { return false; }
public String getDescription() { return JGitText.get().repositoryState_conflicts; }
},
@@ -110,6 +115,7 @@ public enum RepositoryState {
public boolean canCheckout() { return true; }
public boolean canResetHead() { return true; }
public boolean canCommit() { return true; }
+ public boolean canAmend() { return false; }
public String getDescription() { return JGitText.get().repositoryState_merged; }
},
@@ -120,6 +126,7 @@ public enum RepositoryState {
public boolean canCheckout() { return false; }
public boolean canResetHead() { return false; }
public boolean canCommit() { return true; }
+ public boolean canAmend() { return true; }
public String getDescription() { return JGitText.get().repositoryState_rebaseOrApplyMailbox; }
},
@@ -130,6 +137,7 @@ public enum RepositoryState {
public boolean canCheckout() { return false; }
public boolean canResetHead() { return false; }
public boolean canCommit() { return true; }
+ public boolean canAmend() { return true; }
public String getDescription() { return JGitText.get().repositoryState_rebase; }
},
@@ -140,6 +148,7 @@ public enum RepositoryState {
public boolean canCheckout() { return false; }
public boolean canResetHead() { return false; }
public boolean canCommit() { return true; }
+ public boolean canAmend() { return true; }
public String getDescription() { return JGitText.get().repositoryState_applyMailbox; }
},
@@ -150,6 +159,7 @@ public enum RepositoryState {
public boolean canCheckout() { return false; }
public boolean canResetHead() { return false; }
public boolean canCommit() { return true; }
+ public boolean canAmend() { return true; }
public String getDescription() { return JGitText.get().repositoryState_rebaseWithMerge; }
},
@@ -160,6 +170,7 @@ public enum RepositoryState {
public boolean canCheckout() { return false; }
public boolean canResetHead() { return false; }
public boolean canCommit() { return true; }
+ public boolean canAmend() { return true; }
public String getDescription() { return JGitText.get().repositoryState_rebaseInteractive; }
},
@@ -176,6 +187,8 @@ public enum RepositoryState {
/* Commit during bisect is useful */
public boolean canCommit() { return true; }
+ public boolean canAmend() { return false; }
+
public String getDescription() { return JGitText.get().repositoryState_bisecting; }
};
@@ -195,6 +208,11 @@ public enum RepositoryState {
public abstract boolean canResetHead();
/**
+ * @return true if amending is considered SAFE
+ */
+ public abstract boolean canAmend();
+
+ /**
* @return a human readable description of the state.
*/
public abstract String getDescription();