Browse Source

add commits analyzis

Signed-off-by: Maxim Sukharev <max@smacker.ru>
Maxim Sukharev 6 năm trước cách đây
mục cha
commit
fddf32b982
4 tập tin đã thay đổi với 612 bổ sung94 xóa
  1. 198 89
      internal/pb/pb.pb.go
  2. 18 0
      internal/pb/pb.proto
  3. 167 5
      internal/pb/pb_pb2.py
  4. 229 0
      leaves/commits.go

+ 198 - 89
internal/pb/pb.pb.go

@@ -29,6 +29,9 @@ It has these top-level messages:
 	DevsAnalysisResults
 	Sentiment
 	CommentSentimentResults
+	CommitFile
+	Commit
+	CommitsAnalysisResults
 	AnalysisResults
 */
 package pb
@@ -720,6 +723,102 @@ func (m *CommentSentimentResults) GetSentimentByDay() map[int32]*Sentiment {
 	return nil
 }
 
+type CommitFile struct {
+	Name     string     `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+	Language string     `protobuf:"bytes,3,opt,name=language,proto3" json:"language,omitempty"`
+	Stats    *LineStats `protobuf:"bytes,4,opt,name=stats" json:"stats,omitempty"`
+}
+
+func (m *CommitFile) Reset()                    { *m = CommitFile{} }
+func (m *CommitFile) String() string            { return proto.CompactTextString(m) }
+func (*CommitFile) ProtoMessage()               {}
+func (*CommitFile) Descriptor() ([]byte, []int) { return fileDescriptorPb, []int{21} }
+
+func (m *CommitFile) GetName() string {
+	if m != nil {
+		return m.Name
+	}
+	return ""
+}
+
+func (m *CommitFile) GetLanguage() string {
+	if m != nil {
+		return m.Language
+	}
+	return ""
+}
+
+func (m *CommitFile) GetStats() *LineStats {
+	if m != nil {
+		return m.Stats
+	}
+	return nil
+}
+
+type Commit struct {
+	Hash         string        `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
+	WhenUnixTime int64         `protobuf:"varint,2,opt,name=when_unix_time,json=whenUnixTime,proto3" json:"when_unix_time,omitempty"`
+	Author       int32         `protobuf:"varint,3,opt,name=author,proto3" json:"author,omitempty"`
+	Files        []*CommitFile `protobuf:"bytes,4,rep,name=files" json:"files,omitempty"`
+}
+
+func (m *Commit) Reset()                    { *m = Commit{} }
+func (m *Commit) String() string            { return proto.CompactTextString(m) }
+func (*Commit) ProtoMessage()               {}
+func (*Commit) Descriptor() ([]byte, []int) { return fileDescriptorPb, []int{22} }
+
+func (m *Commit) GetHash() string {
+	if m != nil {
+		return m.Hash
+	}
+	return ""
+}
+
+func (m *Commit) GetWhenUnixTime() int64 {
+	if m != nil {
+		return m.WhenUnixTime
+	}
+	return 0
+}
+
+func (m *Commit) GetAuthor() int32 {
+	if m != nil {
+		return m.Author
+	}
+	return 0
+}
+
+func (m *Commit) GetFiles() []*CommitFile {
+	if m != nil {
+		return m.Files
+	}
+	return nil
+}
+
+type CommitsAnalysisResults struct {
+	Commits     []*Commit `protobuf:"bytes,1,rep,name=commits" json:"commits,omitempty"`
+	AuthorIndex []string  `protobuf:"bytes,2,rep,name=author_index,json=authorIndex" json:"author_index,omitempty"`
+}
+
+func (m *CommitsAnalysisResults) Reset()                    { *m = CommitsAnalysisResults{} }
+func (m *CommitsAnalysisResults) String() string            { return proto.CompactTextString(m) }
+func (*CommitsAnalysisResults) ProtoMessage()               {}
+func (*CommitsAnalysisResults) Descriptor() ([]byte, []int) { return fileDescriptorPb, []int{23} }
+
+func (m *CommitsAnalysisResults) GetCommits() []*Commit {
+	if m != nil {
+		return m.Commits
+	}
+	return nil
+}
+
+func (m *CommitsAnalysisResults) GetAuthorIndex() []string {
+	if m != nil {
+		return m.AuthorIndex
+	}
+	return nil
+}
+
 type AnalysisResults struct {
 	Header *Metadata `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
 	// the mapped values are dynamic messages which require the second parsing pass.
@@ -729,7 +828,7 @@ type AnalysisResults struct {
 func (m *AnalysisResults) Reset()                    { *m = AnalysisResults{} }
 func (m *AnalysisResults) String() string            { return proto.CompactTextString(m) }
 func (*AnalysisResults) ProtoMessage()               {}
-func (*AnalysisResults) Descriptor() ([]byte, []int) { return fileDescriptorPb, []int{21} }
+func (*AnalysisResults) Descriptor() ([]byte, []int) { return fileDescriptorPb, []int{24} }
 
 func (m *AnalysisResults) GetHeader() *Metadata {
 	if m != nil {
@@ -767,98 +866,108 @@ func init() {
 	proto.RegisterType((*DevsAnalysisResults)(nil), "DevsAnalysisResults")
 	proto.RegisterType((*Sentiment)(nil), "Sentiment")
 	proto.RegisterType((*CommentSentimentResults)(nil), "CommentSentimentResults")
+	proto.RegisterType((*CommitFile)(nil), "CommitFile")
+	proto.RegisterType((*Commit)(nil), "Commit")
+	proto.RegisterType((*CommitsAnalysisResults)(nil), "CommitsAnalysisResults")
 	proto.RegisterType((*AnalysisResults)(nil), "AnalysisResults")
 }
 
 func init() { proto.RegisterFile("pb.proto", fileDescriptorPb) }
 
 var fileDescriptorPb = []byte{
-	// 1390 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x57, 0x4d, 0x8f, 0xdc, 0x44,
-	0x13, 0x96, 0xe7, 0x7b, 0x6a, 0x76, 0x67, 0x93, 0xce, 0xbe, 0x59, 0x67, 0x5e, 0x6d, 0x18, 0xac,
-	0x10, 0x2d, 0x24, 0x38, 0xd1, 0x86, 0x43, 0x08, 0x97, 0xec, 0x07, 0x51, 0x56, 0xca, 0x12, 0xf0,
-	0x24, 0xe1, 0x68, 0xf5, 0xda, 0xbd, 0x3b, 0x86, 0x71, 0xdb, 0xea, 0xb6, 0x67, 0x76, 0x24, 0x7e,
-	0x0b, 0x37, 0x0e, 0x20, 0x71, 0xe2, 0x0f, 0x70, 0xe0, 0xc2, 0x95, 0x1f, 0x81, 0xc4, 0xbf, 0x40,
-	0xfd, 0xe5, 0xb1, 0x07, 0x6f, 0x08, 0x37, 0x57, 0xd5, 0x53, 0xdd, 0x4f, 0x3f, 0x55, 0x5d, 0x3d,
-	0x03, 0xbd, 0xf4, 0xcc, 0x4d, 0x59, 0x92, 0x25, 0xce, 0x9f, 0x0d, 0xe8, 0x9d, 0x92, 0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, 0xf4,
-	0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x48, 0x21, 0x38, 0x53, 0xbc, 0x0d, 0x00, 0x00,
+	// 1495 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x57, 0xcb, 0x6e, 0xdb, 0x46,
+	0x17, 0x06, 0x75, 0xd7, 0x91, 0x2c, 0x27, 0x13, 0xff, 0x36, 0xa3, 0x1f, 0xce, 0xaf, 0x10, 0xfe,
+	0x03, 0xb7, 0x49, 0x99, 0xc0, 0xe9, 0x22, 0x4d, 0x37, 0xb1, 0xe5, 0x06, 0x31, 0x10, 0x37, 0x2d,
+	0x95, 0xa4, 0xbb, 0x08, 0x63, 0x71, 0x6c, 0xb1, 0x95, 0x86, 0xc4, 0x0c, 0x29, 0x59, 0x40, 0xfb,
+	0x2a, 0xdd, 0x75, 0xd1, 0x02, 0x5d, 0xf5, 0x05, 0xba, 0xe8, 0xa6, 0xdb, 0x3e, 0x44, 0x81, 0xbe,
+	0x45, 0x31, 0x37, 0x5e, 0x14, 0x3a, 0x4d, 0x77, 0x3c, 0xe7, 0x7c, 0x67, 0xe6, 0xcc, 0x77, 0x2e,
+	0x33, 0x84, 0x56, 0x74, 0xe6, 0x46, 0x2c, 0x8c, 0x43, 0xe7, 0xcf, 0x0a, 0xb4, 0x4e, 0x49, 0x8c,
+	0x7d, 0x1c, 0x63, 0x64, 0x43, 0x73, 0x41, 0x18, 0x0f, 0x42, 0x6a, 0x5b, 0x03, 0x6b, 0xbf, 0xee,
+	0x19, 0x11, 0x21, 0xa8, 0x4d, 0x31, 0x9f, 0xda, 0x95, 0x81, 0xb5, 0xdf, 0xf6, 0xe4, 0x37, 0xba,
+	0x05, 0xc0, 0x48, 0x14, 0xf2, 0x20, 0x0e, 0xd9, 0xca, 0xae, 0x4a, 0x4b, 0x4e, 0x83, 0xee, 0xc0,
+	0xe6, 0x19, 0xb9, 0x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0xe6, 0xdb, 0x2b, 0x37, 0xa6, 0x04, 0xfb, 0x84, 0xc9, 0xa3, 0x76, 0x0e,
+	0xda, 0xe9, 0x5f, 0x96, 0xa7, 0x0d, 0xe8, 0xb1, 0x28, 0x37, 0x1a, 0xa7, 0xe5, 0x26, 0x3a, 0x65,
+	0xbd, 0x4b, 0x86, 0x1a, 0x90, 0xde, 0x82, 0x4a, 0x54, 0xb7, 0x60, 0xce, 0xf4, 0x4f, 0xff, 0x5f,
+	0xdd, 0x5c, 0xba, 0xcf, 0x1a, 0xf2, 0x7f, 0xf7, 0xe1, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x2e,
+	0x80, 0xba, 0x8e, 0xfb, 0x0e, 0x00, 0x00,
 }

+ 18 - 0
internal/pb/pb.proto

@@ -147,6 +147,24 @@ message CommentSentimentResults {
     map<int32, Sentiment> sentiment_by_day = 1;
 }
 
+message CommitFile {
+    string name = 1;
+    string language = 3;
+    LineStats stats = 4;
+}
+
+message Commit {
+    string hash = 1;
+    int64 when_unix_time = 2;
+    int32 author = 3;
+    repeated CommitFile files = 4;
+}
+
+message CommitsAnalysisResults {
+    repeated Commit commits = 1;
+    repeated string author_index = 2;
+}
+
 message AnalysisResults {
     Metadata header = 1;
     // the mapped values are dynamic messages which require the second parsing pass.

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 167 - 5
internal/pb/pb_pb2.py


+ 229 - 0
leaves/commits.go

@@ -0,0 +1,229 @@
+package leaves
+
+import (
+	"fmt"
+	"io"
+
+	"github.com/gogo/protobuf/proto"
+	git "gopkg.in/src-d/go-git.v4"
+	"gopkg.in/src-d/go-git.v4/plumbing"
+	"gopkg.in/src-d/go-git.v4/plumbing/object"
+	"gopkg.in/src-d/hercules.v9/internal/core"
+	"gopkg.in/src-d/hercules.v9/internal/pb"
+	items "gopkg.in/src-d/hercules.v9/internal/plumbing"
+	"gopkg.in/src-d/hercules.v9/internal/plumbing/identity"
+	"gopkg.in/src-d/hercules.v9/internal/yaml"
+)
+
+// CommitsAnalysis extracts statistics for each commit
+type CommitsAnalysis struct {
+	core.NoopMerger
+	core.OneShotMergeProcessor
+
+	// days maps days to developers to stats
+	commits []*CommitStat
+	// reversedPeopleDict references IdentityDetector.ReversedPeopleDict
+	reversedPeopleDict []string
+}
+
+// CommitsResult is returned by CommitsAnalysis.Finalize() and carries the statistics
+// per commit.
+type CommitsResult struct {
+	Commits []*CommitStat
+
+	// reversedPeopleDict references IdentityDetector.ReversedPeopleDict
+	reversedPeopleDict []string
+}
+
+// FileStat is a statistic for a file
+type FileStat struct {
+	Name     string
+	Language string
+	items.LineStats
+}
+
+// CommitStat is the statistics for a commit
+type CommitStat struct {
+	Hash   string
+	When   int64
+	Author int
+	Files  []FileStat
+}
+
+// Name of this PipelineItem. Uniquely identifies the type, used for mapping keys, etc.
+func (ca *CommitsAnalysis) Name() string {
+	return "CommitsStat"
+}
+
+// Provides returns the list of names of entities which are produced by this PipelineItem.
+// Each produced entity will be inserted into `deps` of dependent Consume()-s according
+// to this list. Also used by core.Registry to build the global map of providers.
+func (ca *CommitsAnalysis) Provides() []string {
+	return []string{}
+}
+
+// Requires returns the list of names of entities which are needed by this PipelineItem.
+// Each requested entity will be inserted into `deps` of Consume(). In turn, those
+// entities are Provides() upstream.
+func (ca *CommitsAnalysis) Requires() []string {
+	arr := [...]string{
+		identity.DependencyAuthor, items.DependencyLanguages, items.DependencyLineStats}
+	return arr[:]
+}
+
+// ListConfigurationOptions returns the list of changeable public properties of this PipelineItem.
+func (ca *CommitsAnalysis) ListConfigurationOptions() []core.ConfigurationOption {
+	return nil
+}
+
+// Configure sets the properties previously published by ListConfigurationOptions().
+func (ca *CommitsAnalysis) Configure(facts map[string]interface{}) error {
+	if val, exists := facts[identity.FactIdentityDetectorReversedPeopleDict].([]string); exists {
+		ca.reversedPeopleDict = val
+	}
+	return nil
+}
+
+// Flag for the command line switch which enables this analysis.
+func (ca *CommitsAnalysis) Flag() string {
+	return "commits-stat"
+}
+
+// Description returns the text which explains what the analysis is doing.
+func (ca *CommitsAnalysis) Description() string {
+	return "Extracts statistics for each commit."
+}
+
+// Initialize resets the temporary caches and prepares this PipelineItem for a series of Consume()
+// calls. The repository which is going to be analysed is supplied as an argument.
+func (ca *CommitsAnalysis) Initialize(repository *git.Repository) error {
+	ca.OneShotMergeProcessor.Initialize()
+	return nil
+}
+
+// Consume runs this PipelineItem on the next commit data.
+// `deps` contain all the results from upstream PipelineItem-s as requested by Requires().
+// Additionally, DependencyCommit is always present there and represents the analysed *object.Commit.
+// This function returns the mapping with analysis results. The keys must be the same as
+// in Provides(). If there was an error, nil is returned.
+func (ca *CommitsAnalysis) Consume(deps map[string]interface{}) (map[string]interface{}, error) {
+	if !ca.ShouldConsumeCommit(deps) {
+		return nil, nil
+	}
+	if deps[core.DependencyIsMerge].(bool) {
+		return nil, nil
+	}
+
+	commit := deps[core.DependencyCommit].(*object.Commit)
+	author := deps[identity.DependencyAuthor].(int)
+	lineStats := deps[items.DependencyLineStats].(map[object.ChangeEntry]items.LineStats)
+	langs := deps[items.DependencyLanguages].(map[plumbing.Hash]string)
+
+	cs := CommitStat{
+		Hash:   commit.Hash.String(),
+		When:   commit.Author.When.Unix(),
+		Author: author,
+	}
+
+	for entry, stats := range lineStats {
+		cs.Files = append(cs.Files, FileStat{
+			Name:      entry.Name,
+			Language:  langs[entry.TreeEntry.Hash],
+			LineStats: stats,
+		})
+	}
+
+	ca.commits = append(ca.commits, &cs)
+
+	return nil, nil
+}
+
+// Finalize returns the result of the analysis. Further Consume() calls are not expected.
+func (ca *CommitsAnalysis) Finalize() interface{} {
+	return CommitsResult{
+		Commits:            ca.commits,
+		reversedPeopleDict: ca.reversedPeopleDict,
+	}
+}
+
+// Fork clones this pipeline item.
+func (ca *CommitsAnalysis) Fork(n int) []core.PipelineItem {
+	return core.ForkSamePipelineItem(ca, n)
+}
+
+// Serialize converts the analysis result as returned by Finalize() to text or bytes.
+// The text format is YAML and the bytes format is Protocol Buffers.
+func (ca *CommitsAnalysis) Serialize(result interface{}, binary bool, writer io.Writer) error {
+	commitsResult := result.(CommitsResult)
+	if binary {
+		return ca.serializeBinary(&commitsResult, writer)
+	}
+	ca.serializeText(&commitsResult, writer)
+	return nil
+}
+
+// Deserialize converts the specified protobuf bytes to DevsResult.
+func (ca *CommitsAnalysis) Deserialize(pbmessage []byte) (interface{}, error) {
+	panic("not implemented")
+}
+
+// MergeResults combines two DevsAnalysis-es together.
+func (ca *CommitsAnalysis) MergeResults(r1, r2 interface{}, c1, c2 *core.CommonAnalysisResult) interface{} {
+	panic("not implemented")
+}
+
+func (ca *CommitsAnalysis) serializeText(result *CommitsResult, writer io.Writer) {
+	fmt.Fprintln(writer, "  commits:")
+	for _, c := range result.Commits {
+		fmt.Fprintf(writer, "    - hash: %s\n", c.Hash)
+		fmt.Fprintf(writer, "      when: %d\n", c.When)
+		fmt.Fprintf(writer, "      author: %d\n", c.Author)
+		fmt.Fprintf(writer, "      files:\n")
+		for _, f := range c.Files {
+			fmt.Fprintf(writer, "       - name: %s\n", f.Name)
+			fmt.Fprintf(writer, "         language: %s\n", f.Language)
+			fmt.Fprintf(writer, "         stat: [%d, %d, %d]\n", f.Added, f.Changed, f.Removed)
+		}
+	}
+	fmt.Fprintln(writer, "  people:")
+	for _, person := range result.reversedPeopleDict {
+		fmt.Fprintf(writer, "  - %s\n", yaml.SafeString(person))
+	}
+}
+
+func (ca *CommitsAnalysis) serializeBinary(result *CommitsResult, writer io.Writer) error {
+	message := pb.CommitsAnalysisResults{}
+	message.AuthorIndex = result.reversedPeopleDict
+	message.Commits = make([]*pb.Commit, len(result.Commits))
+	for i, c := range result.Commits {
+		files := make([]*pb.CommitFile, len(c.Files))
+		for i, f := range c.Files {
+			files[i] = &pb.CommitFile{
+				Name:     f.Name,
+				Language: f.Language,
+				Stats: &pb.LineStats{
+					Added:   int32(f.LineStats.Added),
+					Changed: int32(f.LineStats.Changed),
+					Removed: int32(f.LineStats.Removed),
+				},
+			}
+		}
+
+		message.Commits[i] = &pb.Commit{
+			Hash:         c.Hash,
+			WhenUnixTime: c.When,
+			Author:       int32(c.Author),
+			Files:        files,
+		}
+	}
+	serialized, err := proto.Marshal(&message)
+	if err != nil {
+		return err
+	}
+	_, err = writer.Write(serialized)
+	return err
+}
+
+func init() {
+	core.Registry.Register(&CommitsAnalysis{})
+}