Przeglądaj źródła

Improve logging of the pipeline finalization

Vadim Markovtsev 7 lat temu
rodzic
commit
acaeceb59e
2 zmienionych plików z 6 dodań i 2 usunięć
  1. 5 2
      cmd/hercules/main.go
  2. 1 0
      pipeline.go

+ 5 - 2
cmd/hercules/main.go

@@ -242,7 +242,11 @@ func main() {
 	// core logic
 	pipeline := hercules.NewPipeline(repository)
 	pipeline.OnProgress = func(commit, length int) {
-		fmt.Fprintf(os.Stderr, "%d / %d\r", commit, length)
+		if commit < length {
+			fmt.Fprintf(os.Stderr, "%d / %d\r", commit, length)
+		} else {
+			fmt.Fprint(os.Stderr, "finalizing...    \r")
+		}
 	}
 	// list of commits belonging to the default branch, from oldest to newest
 	// rev-list --first-parent
@@ -293,7 +297,6 @@ func main() {
 	if with_couples {
 		couples_result = result[coupler].(hercules.CouplesResult)
 	}
-	fmt.Fprint(os.Stderr, "                \r")
 	if len(burndown_results.GlobalHistory) == 0 {
 		return
 	}

+ 1 - 0
pipeline.go

@@ -167,6 +167,7 @@ func (pipeline *Pipeline) Run(commits []*object.Commit) (map[PipelineItem]interf
 			}
 		}
 	}
+	onProgress(len(commits), len(commits))
 	result := map[PipelineItem]interface{}{}
 	for _, item := range pipeline.items {
 		result[item] = item.Finalize()