public static ArrayMemory valueOf(PersonIdent value) { ArrayMemory memory = new ArrayMemory(); memory.refOfIndex("name").assign(value.getName()); memory.refOfIndex("email").assign(value.getEmailAddress()); memory.refOfIndex("when").assign(value.getWhen() == null ? Memory.NULL : LongMemory.valueOf(value.getWhen().getTime())); memory.refOfIndex("timeZone").assign( value.getTimeZone() == null ? Memory.NULL : StringMemory.valueOf(value.getTimeZone().getID()) ); return memory; }
/** * {@inheritDoc} * <p> * Hashcode is based only on the email address and timestamp. */ @Override public int hashCode() { int hc = getEmailAddress().hashCode(); hc *= 31; hc += (int) (when / 1000L); return hc; }
/** {@inheritDoc} */ @Override public boolean equals(Object o) { if (o instanceof PersonIdent) { final PersonIdent p = (PersonIdent) o; return getName().equals(p.getName()) && getEmailAddress().equals(p.getEmailAddress()) && when / 1000L == p.when / 1000L; } return false; }
/** * Copy a {@link org.eclipse.jgit.lib.PersonIdent}, but alter the clone's * time stamp * * @param pi * original {@link org.eclipse.jgit.lib.PersonIdent} * @param aWhen * local time */ public PersonIdent(PersonIdent pi, Date aWhen) { this(pi.getName(), pi.getEmailAddress(), aWhen.getTime(), pi.tzOffset); }
/** * Copy a {@link org.eclipse.jgit.lib.PersonIdent}. * * @param pi * Original {@link org.eclipse.jgit.lib.PersonIdent} */ public PersonIdent(PersonIdent pi) { this(pi.getName(), pi.getEmailAddress()); }
/** * Copy a PersonIdent, but alter the clone's time stamp * * @param pi * original {@link org.eclipse.jgit.lib.PersonIdent} * @param when * local time * @param tz * time zone */ public PersonIdent(PersonIdent pi, Date when, TimeZone tz) { this(pi.getName(), pi.getEmailAddress(), when, tz); }
@Override public String getCommitAuthorEmail() throws GitCommitIdExecutionException { return evalCommit.getAuthorIdent().getEmailAddress(); }
/** * Copy a PersonIdent, but alter the clone's time stamp * * @param pi * original {@link org.eclipse.jgit.lib.PersonIdent} * @param aWhen * local time stamp * @param aTZ * time zone */ public PersonIdent(PersonIdent pi, long aWhen, int aTZ) { this(pi.getName(), pi.getEmailAddress(), aWhen, aTZ); }
private String toString(PersonIdent author) { final StringBuilder a = new StringBuilder(); a.append("Author: "); //$NON-NLS-1$ a.append(author.getName()); a.append(" <"); //$NON-NLS-1$ a.append(author.getEmailAddress()); a.append(">\n"); //$NON-NLS-1$ a.append("Date: "); //$NON-NLS-1$ a.append(dateFormatter.formatDate(author)); a.append("\n"); //$NON-NLS-1$ return a.toString(); } }
/** {@inheritDoc} */ @Override @SuppressWarnings("nls") public String toString() { final StringBuilder r = new StringBuilder(); final SimpleDateFormat dtfmt; dtfmt = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy Z", Locale.US); dtfmt.setTimeZone(getTimeZone()); r.append("PersonIdent["); r.append(getName()); r.append(", "); r.append(getEmailAddress()); r.append(", "); r.append(dtfmt.format(Long.valueOf(when))); r.append("]"); return r.toString(); } }
private static boolean canCombine(@Nullable PersonIdent a, @Nullable PersonIdent b) { if (a != null && b != null) { // Same name and email address. Combine timestamp as the two // proposals are running concurrently and appear together or // not at all from the point of view of an outside reader. return a.getName().equals(b.getName()) && a.getEmailAddress().equals(b.getEmailAddress()); } // If a and b are null, both will be the system identity. return a == null && b == null; }
String toAuthorScript(PersonIdent author) { StringBuilder sb = new StringBuilder(100); sb.append(GIT_AUTHOR_NAME); sb.append("='"); //$NON-NLS-1$ sb.append(author.getName()); sb.append("'\n"); //$NON-NLS-1$ sb.append(GIT_AUTHOR_EMAIL); sb.append("='"); //$NON-NLS-1$ sb.append(author.getEmailAddress()); sb.append("'\n"); //$NON-NLS-1$ // the command line uses the "external String" // representation for date and timezone sb.append(GIT_AUTHOR_DATE); sb.append("='"); //$NON-NLS-1$ sb.append("@"); // @ for time in seconds since 1970 //$NON-NLS-1$ String externalString = author.toExternalString(); sb .append(externalString.substring(externalString .lastIndexOf('>') + 2)); sb.append("'\n"); //$NON-NLS-1$ return sb.toString(); }
LogEntry(String refName, long updateIndex, PersonIdent who, ObjectId oldId, ObjectId newId, String message) { super(key(refName, updateIndex)); this.oldId = oldId; this.newId = newId; this.timeSecs = who.getWhen().getTime() / 1000L; this.tz = (short) who.getTimeZoneOffset(); this.name = who.getName().getBytes(UTF_8); this.email = who.getEmailAddress().getBytes(UTF_8); this.msg = message.getBytes(UTF_8); }
/** * Format for Git storage. * * @return a string in the git author format */ public String toExternalString() { final StringBuilder r = new StringBuilder(); appendSanitized(r, getName()); r.append(" <"); //$NON-NLS-1$ appendSanitized(r, getEmailAddress()); r.append("> "); //$NON-NLS-1$ r.append(when / 1000); r.append(' '); appendTimezone(r, tzOffset); return r.toString(); }
/** * Create a signed off by filter matching the person * * @param person * must be non-null */ public SignedOffByFilter(final PersonIdent person) { super(Pattern.quote(MessageFormat.format(SIGNED_OFF_BY, person.getName(), person.getEmailAddress())), MULTILINE); this.person = person; }
private String author(int line) { PersonIdent author = blame.getSourceAuthor(line); if (author == null) return ""; //$NON-NLS-1$ String name = showAuthorEmail ? author.getEmailAddress() : author .getName(); return name != null ? name : ""; //$NON-NLS-1$ }
@Sessional @Override public User find(PersonIdent person) { return findByEmail(person.getEmailAddress()); }
public PersonIdentDTO(PersonIdent ident) { this.name = ident.getName(); this.emailAddress = ident.getEmailAddress(); this.timeZone = ident.getTimeZone().getID(); this.when = ident.getWhen(); }
private String formatCommitInfo() { PersonIdent committer, author; committer = mCommit.getCommitterIdent(); author = mCommit.getAuthorIdent(); return "commit " + mNewCommit + "\n" + "Author: " + author.getName() + " <" + author.getEmailAddress() + ">\n" + "AuthorDate: " + author.getWhen() + "\n" + "Commit: " + committer.getName() + " <" + committer.getEmailAddress() + ">\n" + "CommitDate: " + committer.getWhen() + "\n"; }
@Override protected void onInitialize() { super.onInitialize(); add(new UserIdentPanel("author", UserIdent.of(author, "Git author"), Mode.AVATAR)); if (committer.getEmailAddress().equals(author.getEmailAddress()) && committer.getName().equals(author.getName())) { add(new WebMarkupContainer("committer").setVisible(false)); } else { add(new UserIdentPanel("committer", UserIdent.of(committer, "Git committer"), Mode.AVATAR)); } }