Skip to content

Commit

Permalink
checkout: refine logging levels
Browse files Browse the repository at this point in the history
Reviewed-by: rwestberg
  • Loading branch information
edvbld committed Jan 21, 2021
1 parent c972718 commit 277d620
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
Expand Up @@ -140,9 +140,12 @@ public Collection<WorkItem> run(Path scratch) {
var convertedGitHashes = existing.stream().map(Mark::git).collect(Collectors.toSet());
var gitHead = fromRepo.head();
if (!convertedGitHashes.contains(gitHead)) {
log.info("Found Git commits that needs to be converted. Git HEAD: " + gitHead.hex());
Collections.sort(existing);
converter.convert(fromRepo, toRepo, existing);
hasConverted = true;
} else {
log.info("No new Git commits to convert");
}
}
} finally {
Expand Down
Expand Up @@ -60,7 +60,7 @@ class GitCommitMetadata {

public static CommitMetadata read(UnixStreamReader reader) throws IOException {
var hash = new Hash(reader.readLine());
log.fine("Parsing: " + hash.hex());
log.finest("Parsing: " + hash.hex());

var parentHashes = reader.readLine();
if (parentHashes.equals("")) {
Expand All @@ -74,20 +74,20 @@ public static CommitMetadata read(UnixStreamReader reader) throws IOException {
var dateFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;

var authorName = reader.readLine();
log.finer("authorName: " + authorName);
log.finest("authorName: " + authorName);
var authorEmail = reader.readLine();
log.finer("authorEmail: " + authorEmail);
log.finest("authorEmail: " + authorEmail);
var author = new Author(authorName, authorEmail);
var authored = ZonedDateTime.parse(reader.readLine(), dateFormatter);
log.finer("authorDate: " + authored);
log.finest("authorDate: " + authored);

var committerName = reader.readLine();
log.finer("committerName: " + committerName);
log.finest("committerName: " + committerName);
var committerEmail = reader.readLine();
log.finer("committerEmail " + committerName);
log.finest("committerEmail " + committerName);
var committer = new Author(committerName, committerEmail);
var committed = ZonedDateTime.parse(reader.readLine(), dateFormatter);
log.finer("committerDate: " + committed);
log.finest("committerDate: " + committed);


var message = new ArrayList<String>();
Expand Down
Expand Up @@ -187,6 +187,7 @@ private void convertTags(Repository hgRepo, ReadOnlyRepository gitRepo, Map<Hash
var missing = new TreeSet<>(gitTags);
missing.removeAll(hgTags);
for (var name : missing) {
log.info("Converting tag " + name);
var gitHash = gitRepo.resolve(name).orElseThrow(() ->
new IOException("Cannot resolve known tag " + name)
);
Expand All @@ -201,6 +202,7 @@ private void convertTags(Repository hgRepo, ReadOnlyRepository gitRepo, Map<Hash
hgRepo.tag(hgHash, name, "Added tag " + name + " for " + hgHash.abbreviate(), "duke", null, null);
}
var hgTagCommitHash = hgRepo.head();
log.info("Converted tag " + name + " with resulting hash " + hgTagCommitHash.hex());
var last = marks.get(marks.size() - 1);
var newMark = new Mark(last.key(), last.hg(), last.git(), hgTagCommitHash);
marks.set(marks.size() - 1, newMark);
Expand All @@ -215,7 +217,7 @@ private void convert(List<CommitMetadata> commits,
var gitRoot = gitRepo.root();

for (var commit : commits) {
log.fine("Converting Git hash: " + commit.hash().hex());
log.info("Converting Git hash: " + commit.hash().hex());
var parents = commit.parents();
var gitParent0 = parents.get(0);
var status0 = gitRepo.status(gitParent0, commit.hash());
Expand Down Expand Up @@ -272,7 +274,7 @@ private void convert(List<CommitMetadata> commits,
} else {
hgHash = hgRepo.commit(hgMessage, hgAuthor, null, date);
}
log.fine("Converted hg hash: " + hgHash.hex());
log.info("Converted hg hash: " + hgHash.hex());

marks.add(new Mark(marks.size() + 1, hgHash, commit.hash()));
gitToHg.put(commit.hash(), hgHash);
Expand Down

1 comment on commit 277d620

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.