mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[hg] provide author from email for HgFileRevision since it does not have a separate email field IDEA-153750
HgRevisionNumber now has getName for just name (similar to getEmail) and getAuthor (as it was before my changes).
This commit is contained in:
@@ -51,10 +51,15 @@ public class VcsUserUtil {
|
||||
|
||||
@NotNull
|
||||
private static String getName(@NotNull VcsUser user) {
|
||||
if (!user.getName().isEmpty()) return user.getName();
|
||||
String emailNamePart = getNameFromEmail(user.getEmail());
|
||||
return getUserName(user.getName(), user.getEmail());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getUserName(@NotNull String name, @NotNull String email) {
|
||||
if (!name.isEmpty()) return name;
|
||||
String emailNamePart = getNameFromEmail(email);
|
||||
if (emailNamePart != null) return emailNamePart;
|
||||
return user.getEmail();
|
||||
return email;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -15,6 +15,7 @@ package org.zmlx.hg4idea;
|
||||
import com.google.common.base.Objects;
|
||||
import com.intellij.openapi.util.Couple;
|
||||
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
|
||||
import com.intellij.vcs.log.util.VcsUserUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.zmlx.hg4idea.log.HgBaseLogParser;
|
||||
import org.zmlx.hg4idea.util.HgUtil;
|
||||
@@ -109,10 +110,20 @@ public class HgRevisionNumber implements VcsRevisionNumber {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getAuthor() {
|
||||
public String getName() {
|
||||
return author;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getAuthor() {
|
||||
return VcsUserUtil.getUserName(author, email);
|
||||
}
|
||||
|
||||
public boolean isWorkingVersion() {
|
||||
return isWorkingVersion;
|
||||
}
|
||||
@@ -208,9 +219,4 @@ public class HgRevisionNumber implements VcsRevisionNumber {
|
||||
public String getSubject() {
|
||||
return mySubject;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class HgFileRevisionLogParser extends HgBaseLogParser<HgFileRevision> {
|
||||
}
|
||||
}
|
||||
}
|
||||
return new HgFileRevision(myProject, myHgFile, vcsRevisionNumber, branchName, revisionDate, author, commitMessage,
|
||||
return new HgFileRevision(myProject, myHgFile, vcsRevisionNumber, branchName, revisionDate, vcsRevisionNumber.getAuthor(), commitMessage,
|
||||
filesModified, filesAdded, filesDeleted, copies);
|
||||
}
|
||||
|
||||
|
||||
@@ -172,8 +172,8 @@ public class HgHistoryUtil {
|
||||
vcsFullCommitDetailsList.add(factory.createFullDetails(factory.createHash(vcsRevisionNumber.getChangeset()), parentsHash,
|
||||
revision.getRevisionDate().getTime(), root,
|
||||
vcsRevisionNumber.getSubject(),
|
||||
vcsRevisionNumber.getAuthor(), vcsRevisionNumber.getEmail(),
|
||||
vcsRevisionNumber.getCommitMessage(), vcsRevisionNumber.getAuthor(),
|
||||
vcsRevisionNumber.getName(), vcsRevisionNumber.getEmail(),
|
||||
vcsRevisionNumber.getCommitMessage(), vcsRevisionNumber.getName(),
|
||||
vcsRevisionNumber.getEmail(), revision.getRevisionDate().getTime(),
|
||||
new ThrowableComputable<Collection<Change>, Exception>() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user