* [PATCH JGIT] Use previous author when amending a commit
@ 2009-02-09 9:30 Yann Simon
2009-02-09 15:29 ` Shawn O. Pearce
0 siblings, 1 reply; 2+ messages in thread
From: Yann Simon @ 2009-02-09 9:30 UTC (permalink / raw)
To: Robin Rosenberg, Shawn O. Pearce; +Cc: git
In the commit dialog, when amending the commit, the author of the
previous commit is proposed as default in the author field.
Signed-off-by: Yann Simon <yann.simon.fr@gmail.com>
---
.../egit/ui/internal/actions/CommitAction.java | 5 ++++-
.../egit/ui/internal/dialogs/CommitDialog.java | 12 ++++++++++++
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/CommitAction.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/CommitAction.java
index ae26770..d30172f 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/CommitAction.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/CommitAction.java
@@ -118,8 +118,11 @@ public void run(IAction act) {
commitDialog.setFileList(files);
commitDialog.setAuthor(author);
- if (previousCommit != null)
+ if (previousCommit != null) {
commitDialog.setPreviousCommitMessage(previousCommit.getMessage());
+ PersonIdent previousAuthor = previousCommit.getAuthor();
+ commitDialog.setPreviousAuthor(previousAuthor.getName() + " <" + previousAuthor.getEmailAddress() + ">");
+ }
if (commitDialog.open() != IDialogConstants.OK_ID)
return;
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
index fede948..b122fb8 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
@@ -175,6 +175,7 @@ public void keyPressed(KeyEvent arg0) {
amendingButton.setSelection(amending);
amendingButton.setEnabled(false); // if already set, don't allow any changes
commitText.setText(previousCommitMessage);
+ authorText.setText(previousAuthor);
} else if (!amendAllowed) {
amendingButton.setEnabled(false);
}
@@ -189,6 +190,7 @@ public void widgetSelected(SelectionEvent arg0) {
if (curText.length() > 0)
curText += "\n"; //$NON-NLS-1$
commitText.setText(curText + previousCommitMessage);
+ authorText.setText(previousAuthor);
}
}
@@ -334,6 +336,7 @@ public void setCommitMessage(String s) {
private String commitMessage = ""; //$NON-NLS-1$
private String author = null;
+ private String previousAuthor = null;
private boolean signedOff = false;
private boolean amending = false;
private boolean amendAllowed = true;
@@ -470,6 +473,15 @@ public void setAuthor(String author) {
}
/**
+ * Pre-set the previous author if amending the commit
+ *
+ * @param previousAuthor
+ */
+ public void setPreviousAuthor(String previousAuthor) {
+ this.previousAuthor = previousAuthor;
+ }
+
+ /**
* @return whether to auto-add a signed-off line to the message
*/
public boolean isSignedOff() {
--
1.6.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH JGIT] Use previous author when amending a commit
2009-02-09 9:30 [PATCH JGIT] Use previous author when amending a commit Yann Simon
@ 2009-02-09 15:29 ` Shawn O. Pearce
0 siblings, 0 replies; 2+ messages in thread
From: Shawn O. Pearce @ 2009-02-09 15:29 UTC (permalink / raw)
To: Yann Simon; +Cc: Robin Rosenberg, git
Yann Simon <yann.simon.fr@gmail.com> wrote:
> In the commit dialog, when amending the commit, the author of the
> previous commit is proposed as default in the author field.
>
> Signed-off-by: Yann Simon <yann.simon.fr@gmail.com>
Much better to read when its by itself.
Applied. Thanks.
> .../egit/ui/internal/actions/CommitAction.java | 5 ++++-
> .../egit/ui/internal/dialogs/CommitDialog.java | 12 ++++++++++++
> 2 files changed, 16 insertions(+), 1 deletions(-)
--
Shawn.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-02-09 15:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-09 9:30 [PATCH JGIT] Use previous author when amending a commit Yann Simon
2009-02-09 15:29 ` Shawn O. Pearce
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox