@@ -633,7 +633,7 @@ func CloneAllRepos(git git.Gitter, cloneTargets []scm.Repo) {
633
633
634
634
limit := limiter .NewConcurrencyLimiter (l )
635
635
636
- var cloneCount , pulledCount , updateRemoteCount int
636
+ var cloneCount , pulledCount , updateRemoteCount , newCommits int
637
637
638
638
// maps in go are not safe for concurrent use
639
639
var mutex = & sync.RWMutex {}
@@ -713,7 +713,8 @@ func CloneAllRepos(git git.Gitter, cloneTargets []scm.Repo) {
713
713
}
714
714
715
715
action := "cloning"
716
- if repoExistsLocally (repo ) {
716
+ repoWillBePulled := repoExistsLocally (repo )
717
+ if repoWillBePulled {
717
718
// prevents git from asking for user for credentials, needs to be unset so creds aren't stored
718
719
err := git .SetOriginWithCredentials (repo )
719
720
if err != nil {
@@ -779,6 +780,14 @@ func CloneAllRepos(git git.Gitter, cloneTargets []scm.Repo) {
779
780
}
780
781
}
781
782
783
+ count , _ := git .RepoCommitCount (repo )
784
+ if err != nil {
785
+ e := fmt .Sprintf ("Problem trying to get pre pull commit count for on repo: %s" , repo .URL )
786
+ cloneInfos = append (cloneInfos , e )
787
+ }
788
+
789
+ repo .Commits .CountPrePull = count
790
+
782
791
err = git .Clean (repo )
783
792
784
793
if err != nil {
@@ -803,6 +812,15 @@ func CloneAllRepos(git git.Gitter, cloneTargets []scm.Repo) {
803
812
return
804
813
}
805
814
815
+ count , _ = git .RepoCommitCount (repo )
816
+ if err != nil {
817
+ e := fmt .Sprintf ("Problem trying to get post pull commit count for on repo: %s" , repo .URL )
818
+ cloneInfos = append (cloneInfos , e )
819
+ }
820
+
821
+ repo .Commits .CountPostPull = count
822
+ repo .Commits .CountDiff = (repo .Commits .CountPostPull - repo .Commits .CountPrePull )
823
+ newCommits = (newCommits + repo .Commits .CountDiff )
806
824
action = "pulling"
807
825
pulledCount ++
808
826
}
@@ -864,15 +882,19 @@ func CloneAllRepos(git git.Gitter, cloneTargets []scm.Repo) {
864
882
}
865
883
}
866
884
867
- colorlog .PrintSuccess ("Success " + action + " " + repo .URL + " -> branch: " + repo .CloneBranch )
885
+ if repoWillBePulled && repo .Commits .CountDiff > 0 {
886
+ colorlog .PrintSuccess (fmt .Sprintf ("Success %s %s, branch: %s, new commits: %d" , action , repo .URL , repo .CloneBranch , repo .Commits .CountDiff ))
887
+ } else {
888
+ colorlog .PrintSuccess (fmt .Sprintf ("Success %s %s, branch: %s" , action , repo .URL , repo .CloneBranch ))
889
+ }
868
890
})
869
891
870
892
}
871
893
872
894
limit .WaitAndClose ()
873
895
874
896
printRemainingMessages ()
875
- printCloneStatsMessage (cloneCount , pulledCount , updateRemoteCount )
897
+ printCloneStatsMessage (cloneCount , pulledCount , updateRemoteCount , newCommits )
876
898
877
899
if hasCollisions {
878
900
fmt .Println ("" )
@@ -1025,13 +1047,13 @@ func pruneRepos(cloneTargets []scm.Repo) {
1025
1047
}
1026
1048
}
1027
1049
1028
- func printCloneStatsMessage (cloneCount , pulledCount , updateRemoteCount int ) {
1050
+ func printCloneStatsMessage (cloneCount , pulledCount , updateRemoteCount , newCommits int ) {
1029
1051
if updateRemoteCount > 0 {
1030
- colorlog .PrintSuccess (fmt .Sprintf ("New clones: %v, existing resources pulled: %v, remotes updated: %v" , cloneCount , pulledCount , updateRemoteCount ))
1052
+ colorlog .PrintSuccess (fmt .Sprintf ("New clones: %v, existing resources pulled: %v, total new commits: %v, remotes updated: %v" , cloneCount , pulledCount , newCommits , updateRemoteCount ))
1031
1053
return
1032
1054
}
1033
1055
1034
- colorlog .PrintSuccess (fmt .Sprintf ("New clones: %v, existing resources pulled: %v" , cloneCount , pulledCount ))
1056
+ colorlog .PrintSuccess (fmt .Sprintf ("New clones: %v, existing resources pulled: %v, total new commits: %v " , cloneCount , pulledCount , newCommits ))
1035
1057
}
1036
1058
1037
1059
func interactiveYesNoPrompt (prompt string ) bool {
0 commit comments