Browse Source

RepositoryState: add method canAmend

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>
stable-1.2
Jens Baumgart 13 years ago
parent
commit
99ec987e68
  1. 18
      org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java

18
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; }
};
@ -194,6 +207,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.
*/

Loading…
Cancel
Save