diff options
author | Mathias Kinzler | 2010-08-31 14:12:07 +0000 |
---|---|---|
committer | Mathias Kinzler | 2010-08-31 14:12:07 +0000 |
commit | 93f65bb412cf63edc2698a0fbcaa406db28fee43 (patch) | |
tree | 81c3aeca0436a985cd790968ac2de72d6119045a | |
parent | 0bc93db1b887310e5b4bcd095b0097441647b7c8 (diff) | |
download | egit-93f65bb412cf63edc2698a0fbcaa406db28fee43.tar.gz egit-93f65bb412cf63edc2698a0fbcaa406db28fee43.tar.xz egit-93f65bb412cf63edc2698a0fbcaa406db28fee43.zip |
Remove usage of deprecated PersonIdent constructor
Change-Id: I7706a916f8388bbae948d550005584cadb1e836a
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
6 files changed, 17 insertions, 26 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/TagOperationTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/TagOperationTest.java index ed6248b765..a9e05e7c81 100644 --- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/TagOperationTest.java +++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/TagOperationTest.java @@ -28,11 +28,11 @@ import org.eclipse.egit.core.test.DualRepositoryTestCase; import org.eclipse.egit.core.test.TestRepository; import org.eclipse.egit.core.test.TestUtils; import org.eclipse.jgit.lib.Constants; -import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.TagBuilder; import org.eclipse.jgit.revwalk.RevTag; import org.eclipse.jgit.revwalk.RevWalk; +import org.eclipse.jgit.util.RawParseUtils; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -94,7 +94,7 @@ public class TagOperationTest extends DualRepositoryTestCase { TagBuilder newTag = new TagBuilder(); newTag.setTag("TheNewTag"); newTag.setMessage("Well, I'm the tag"); - newTag.setTagger(new PersonIdent(TestUtils.AUTHOR)); + newTag.setTagger(RawParseUtils.parsePersonIdent(TestUtils.AUTHOR)); newTag.setObjectId(repository1.getRepository() .resolve("refs/heads/master"), Constants.OBJ_COMMIT); TagOperation top = new TagOperation(repository1.getRepository(), diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CommitOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CommitOperation.java index f59655726d..d793a479ad 100644 --- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CommitOperation.java +++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CommitOperation.java @@ -50,6 +50,7 @@ import org.eclipse.jgit.lib.TreeEntry; import org.eclipse.jgit.lib.GitIndex.Entry; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.util.ChangeIdUtil; +import org.eclipse.jgit.util.RawParseUtils; import org.eclipse.osgi.util.NLS; import org.eclipse.team.core.TeamException; @@ -121,8 +122,8 @@ public class CommitOperation implements IEGitOperation { public void run(IProgressMonitor monitor) throws CoreException { final Date commitDate = new Date(); final TimeZone timeZone = TimeZone.getDefault(); - final PersonIdent authorIdent = new PersonIdent(author); - final PersonIdent committerIdent = new PersonIdent(committer); + final PersonIdent authorIdent = RawParseUtils.parsePersonIdent(author); + final PersonIdent committerIdent = RawParseUtils.parsePersonIdent(committer); if (commitAll) { for (Repository repo : repos) { Git git = new Git(repo); @@ -285,8 +286,8 @@ public class CommitOperation implements IEGitOperation { final Date commitDate = new Date(); final TimeZone timeZone = TimeZone.getDefault(); - final PersonIdent authorIdent = new PersonIdent(author); - final PersonIdent committerIdent = new PersonIdent(committer); + final PersonIdent authorIdent = RawParseUtils.parsePersonIdent(author); + final PersonIdent committerIdent = RawParseUtils.parsePersonIdent(committer); for (java.util.Map.Entry<Repository, Tree> entry : treeMap.entrySet()) { Tree tree = entry.getValue(); diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java index da5f683846..397f3899b7 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java @@ -31,9 +31,9 @@ import org.eclipse.egit.ui.test.TestUtil; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; -import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.TagBuilder; +import org.eclipse.jgit.util.RawParseUtils; import org.eclipse.osgi.util.NLS; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotPerspective; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; @@ -68,7 +68,7 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase { TagBuilder tag = new TagBuilder(); tag.setTag("SomeTag"); - tag.setTagger(new PersonIdent(TestUtil.TESTAUTHOR)); + tag.setTagger(RawParseUtils.parsePersonIdent(TestUtil.TESTAUTHOR)); tag.setMessage("I'm just a little tag"); tag.setObjectId(repo.resolve(repo.getFullBranch()), Constants.OBJ_COMMIT); TagOperation top = new TagOperation(repo, tag, false); diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CommitActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CommitActionTest.java index 0c279db734..dcde47afbc 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CommitActionTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CommitActionTest.java @@ -24,9 +24,9 @@ import org.eclipse.egit.ui.common.LocalRepositoryTestCase; import org.eclipse.egit.ui.test.ContextMenuHelper; import org.eclipse.egit.ui.test.TestUtil; import org.eclipse.jgit.lib.Constants; -import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.TagBuilder; +import org.eclipse.jgit.util.RawParseUtils; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotPerspective; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; @@ -57,7 +57,7 @@ public class CommitActionTest extends LocalRepositoryTestCase { TagBuilder tag = new TagBuilder(); tag.setTag("SomeTag"); - tag.setTagger(new PersonIdent(TestUtil.TESTAUTHOR)); + tag.setTagger(RawParseUtils.parsePersonIdent(TestUtil.TESTAUTHOR)); tag.setMessage("I'm just a little tag"); tag.setObjectId(repo.resolve(repo.getFullBranch()), Constants.OBJ_COMMIT); TagOperation top = new TagOperation(repo, tag, false); diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/TagActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/TagActionTest.java index ec40cd5dd3..9797d5f022 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/TagActionTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/TagActionTest.java @@ -25,9 +25,9 @@ import org.eclipse.egit.ui.test.ContextMenuHelper; import org.eclipse.egit.ui.test.TestUtil; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jgit.lib.Constants; -import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.TagBuilder; +import org.eclipse.jgit.util.RawParseUtils; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotPerspective; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; @@ -57,7 +57,7 @@ public class TagActionTest extends LocalRepositoryTestCase { TagBuilder tag = new TagBuilder(); tag.setTag("SomeTag"); - tag.setTagger(new PersonIdent(TestUtil.TESTAUTHOR)); + tag.setTagger(RawParseUtils.parsePersonIdent(TestUtil.TESTAUTHOR)); tag.setMessage("I'm just a little tag"); tag.setObjectId(repo.resolve(repo.getFullBranch()), Constants.OBJ_COMMIT); TagOperation top = new TagOperation(repo, tag, false); diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java index 637b872187..47986ea0df 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java @@ -55,13 +55,13 @@ import org.eclipse.jface.viewers.ViewerComparator; import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.GitIndex; -import org.eclipse.jgit.lib.GitIndex.Entry; import org.eclipse.jgit.lib.ObjectId; -import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.Tree; import org.eclipse.jgit.lib.TreeEntry; +import org.eclipse.jgit.lib.GitIndex.Entry; import org.eclipse.jgit.util.ChangeIdUtil; +import org.eclipse.jgit.util.RawParseUtils; import org.eclipse.swt.SWT; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; @@ -746,12 +746,7 @@ public class CommitDialog extends Dialog { boolean authorValid = false; if (author.length() > 0) { - try { - new PersonIdent(author); - authorValid = true; - } catch (IllegalArgumentException e) { - authorValid = false; - } + authorValid = RawParseUtils.parsePersonIdent(author) != null; } if (!authorValid) { MessageDialog.openWarning(getShell(), UIText.CommitDialog_ErrorInvalidAuthor, UIText.CommitDialog_ErrorInvalidAuthorSpecified); @@ -760,12 +755,7 @@ public class CommitDialog extends Dialog { boolean committerValid = false; if (committer.length() > 0) { - try { - new PersonIdent(committer); - committerValid = true; - } catch (IllegalArgumentException e) { - committerValid = false; - } + committerValid = RawParseUtils.parsePersonIdent(committer)!=null; } if (!committerValid) { MessageDialog.openWarning(getShell(), UIText.CommitDialog_ErrorInvalidAuthor, UIText.CommitDialog_ErrorInvalidCommitterSpecified); |