1060 lines
24 KiB
Go
1060 lines
24 KiB
Go
// Code generated by protoc-gen-gogo.
|
|
// source: diff.proto
|
|
// DO NOT EDIT!
|
|
|
|
/*
|
|
Package diff is a generated protocol buffer package.
|
|
|
|
It is generated from these files:
|
|
diff.proto
|
|
|
|
It has these top-level messages:
|
|
FileDiff
|
|
Hunk
|
|
Stat
|
|
*/
|
|
package diff
|
|
|
|
import proto "github.com/gogo/protobuf/proto"
|
|
import fmt "fmt"
|
|
import math "math"
|
|
|
|
// discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto"
|
|
import pbtypes "sourcegraph.com/sqs/pbtypes"
|
|
|
|
import io "io"
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
// A FileDiff represents a unified diff for a single file.
|
|
//
|
|
// A file unified diff has a header that resembles the following:
|
|
//
|
|
// --- oldname 2009-10-11 15:12:20.000000000 -0700
|
|
// +++ newname 2009-10-11 15:12:30.000000000 -0700
|
|
type FileDiff struct {
|
|
// the original name of the file
|
|
OrigName string `protobuf:"bytes,1,opt,name=OrigName,proto3" json:"OrigName,omitempty"`
|
|
// the original timestamp (nil if not present)
|
|
OrigTime *pbtypes.Timestamp `protobuf:"bytes,2,opt,name=OrigTime" json:"OrigTime,omitempty"`
|
|
// the new name of the file (often same as OrigName)
|
|
NewName string `protobuf:"bytes,3,opt,name=NewName,proto3" json:"NewName,omitempty"`
|
|
// the new timestamp (nil if not present)
|
|
NewTime *pbtypes.Timestamp `protobuf:"bytes,4,opt,name=NewTime" json:"NewTime,omitempty"`
|
|
// extended header lines (e.g., git's "new mode <mode>", "rename from <path>", etc.)
|
|
Extended []string `protobuf:"bytes,5,rep,name=Extended" json:"Extended,omitempty"`
|
|
// hunks that were changed from orig to new
|
|
Hunks []*Hunk `protobuf:"bytes,6,rep,name=Hunks" json:"Hunks,omitempty"`
|
|
}
|
|
|
|
func (m *FileDiff) Reset() { *m = FileDiff{} }
|
|
func (m *FileDiff) String() string { return proto.CompactTextString(m) }
|
|
func (*FileDiff) ProtoMessage() {}
|
|
|
|
// A Hunk represents a series of changes (additions or deletions) in a file's
|
|
// unified diff.
|
|
type Hunk struct {
|
|
// starting line number in original file
|
|
OrigStartLine int32 `protobuf:"varint,1,opt,name=OrigStartLine,proto3" json:"OrigStartLine,omitempty"`
|
|
// number of lines the hunk applies to in the original file
|
|
OrigLines int32 `protobuf:"varint,2,opt,name=OrigLines,proto3" json:"OrigLines,omitempty"`
|
|
// if > 0, then the original file had a 'No newline at end of file' mark at this offset
|
|
OrigNoNewlineAt int32 `protobuf:"varint,3,opt,name=OrigNoNewlineAt,proto3" json:"OrigNoNewlineAt,omitempty"`
|
|
// starting line number in new file
|
|
NewStartLine int32 `protobuf:"varint,4,opt,name=NewStartLine,proto3" json:"NewStartLine,omitempty"`
|
|
// number of lines the hunk applies to in the new file
|
|
NewLines int32 `protobuf:"varint,5,opt,name=NewLines,proto3" json:"NewLines,omitempty"`
|
|
// optional section heading
|
|
Section string `protobuf:"bytes,6,opt,name=Section,proto3" json:"Section,omitempty"`
|
|
// 0-indexed line offset in unified file diff (including section headers); this is
|
|
// only set when Hunks are read from entire file diff (i.e., when ReadAllHunks is
|
|
// called) This accounts for hunk headers, too, so the StartPosition of the first
|
|
// hunk will be 1.
|
|
StartPosition int32 `protobuf:"varint,7,opt,name=StartPosition,proto3" json:"StartPosition,omitempty"`
|
|
// hunk body (lines prefixed with '-', '+', or ' ')
|
|
Body []byte `protobuf:"bytes,8,opt,name=Body,proto3" json:"Body,omitempty"`
|
|
}
|
|
|
|
func (m *Hunk) Reset() { *m = Hunk{} }
|
|
func (m *Hunk) String() string { return proto.CompactTextString(m) }
|
|
func (*Hunk) ProtoMessage() {}
|
|
|
|
// A Stat is a diff stat that represents the number of lines added/changed/deleted.
|
|
type Stat struct {
|
|
// number of lines added
|
|
Added int32 `protobuf:"varint,1,opt,name=Added,proto3" json:""`
|
|
// number of lines changed
|
|
Changed int32 `protobuf:"varint,2,opt,name=Changed,proto3" json:""`
|
|
// number of lines deleted
|
|
Deleted int32 `protobuf:"varint,3,opt,name=Deleted,proto3" json:""`
|
|
}
|
|
|
|
func (m *Stat) Reset() { *m = Stat{} }
|
|
func (m *Stat) String() string { return proto.CompactTextString(m) }
|
|
func (*Stat) ProtoMessage() {}
|
|
|
|
func (m *FileDiff) Marshal() (data []byte, err error) {
|
|
size := m.Size()
|
|
data = make([]byte, size)
|
|
n, err := m.MarshalTo(data)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return data[:n], nil
|
|
}
|
|
|
|
func (m *FileDiff) MarshalTo(data []byte) (int, error) {
|
|
var i int
|
|
_ = i
|
|
var l int
|
|
_ = l
|
|
if len(m.OrigName) > 0 {
|
|
data[i] = 0xa
|
|
i++
|
|
i = encodeVarintDiff(data, i, uint64(len(m.OrigName)))
|
|
i += copy(data[i:], m.OrigName)
|
|
}
|
|
if m.OrigTime != nil {
|
|
data[i] = 0x12
|
|
i++
|
|
i = encodeVarintDiff(data, i, uint64(m.OrigTime.Size()))
|
|
n1, err := m.OrigTime.MarshalTo(data[i:])
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
i += n1
|
|
}
|
|
if len(m.NewName) > 0 {
|
|
data[i] = 0x1a
|
|
i++
|
|
i = encodeVarintDiff(data, i, uint64(len(m.NewName)))
|
|
i += copy(data[i:], m.NewName)
|
|
}
|
|
if m.NewTime != nil {
|
|
data[i] = 0x22
|
|
i++
|
|
i = encodeVarintDiff(data, i, uint64(m.NewTime.Size()))
|
|
n2, err := m.NewTime.MarshalTo(data[i:])
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
i += n2
|
|
}
|
|
if len(m.Extended) > 0 {
|
|
for _, s := range m.Extended {
|
|
data[i] = 0x2a
|
|
i++
|
|
l = len(s)
|
|
for l >= 1<<7 {
|
|
data[i] = uint8(uint64(l)&0x7f | 0x80)
|
|
l >>= 7
|
|
i++
|
|
}
|
|
data[i] = uint8(l)
|
|
i++
|
|
i += copy(data[i:], s)
|
|
}
|
|
}
|
|
if len(m.Hunks) > 0 {
|
|
for _, msg := range m.Hunks {
|
|
data[i] = 0x32
|
|
i++
|
|
i = encodeVarintDiff(data, i, uint64(msg.Size()))
|
|
n, err := msg.MarshalTo(data[i:])
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
i += n
|
|
}
|
|
}
|
|
return i, nil
|
|
}
|
|
|
|
func (m *Hunk) Marshal() (data []byte, err error) {
|
|
size := m.Size()
|
|
data = make([]byte, size)
|
|
n, err := m.MarshalTo(data)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return data[:n], nil
|
|
}
|
|
|
|
func (m *Hunk) MarshalTo(data []byte) (int, error) {
|
|
var i int
|
|
_ = i
|
|
var l int
|
|
_ = l
|
|
if m.OrigStartLine != 0 {
|
|
data[i] = 0x8
|
|
i++
|
|
i = encodeVarintDiff(data, i, uint64(m.OrigStartLine))
|
|
}
|
|
if m.OrigLines != 0 {
|
|
data[i] = 0x10
|
|
i++
|
|
i = encodeVarintDiff(data, i, uint64(m.OrigLines))
|
|
}
|
|
if m.OrigNoNewlineAt != 0 {
|
|
data[i] = 0x18
|
|
i++
|
|
i = encodeVarintDiff(data, i, uint64(m.OrigNoNewlineAt))
|
|
}
|
|
if m.NewStartLine != 0 {
|
|
data[i] = 0x20
|
|
i++
|
|
i = encodeVarintDiff(data, i, uint64(m.NewStartLine))
|
|
}
|
|
if m.NewLines != 0 {
|
|
data[i] = 0x28
|
|
i++
|
|
i = encodeVarintDiff(data, i, uint64(m.NewLines))
|
|
}
|
|
if len(m.Section) > 0 {
|
|
data[i] = 0x32
|
|
i++
|
|
i = encodeVarintDiff(data, i, uint64(len(m.Section)))
|
|
i += copy(data[i:], m.Section)
|
|
}
|
|
if m.StartPosition != 0 {
|
|
data[i] = 0x38
|
|
i++
|
|
i = encodeVarintDiff(data, i, uint64(m.StartPosition))
|
|
}
|
|
if m.Body != nil {
|
|
if len(m.Body) > 0 {
|
|
data[i] = 0x42
|
|
i++
|
|
i = encodeVarintDiff(data, i, uint64(len(m.Body)))
|
|
i += copy(data[i:], m.Body)
|
|
}
|
|
}
|
|
return i, nil
|
|
}
|
|
|
|
func (m *Stat) Marshal() (data []byte, err error) {
|
|
size := m.Size()
|
|
data = make([]byte, size)
|
|
n, err := m.MarshalTo(data)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return data[:n], nil
|
|
}
|
|
|
|
func (m *Stat) MarshalTo(data []byte) (int, error) {
|
|
var i int
|
|
_ = i
|
|
var l int
|
|
_ = l
|
|
if m.Added != 0 {
|
|
data[i] = 0x8
|
|
i++
|
|
i = encodeVarintDiff(data, i, uint64(m.Added))
|
|
}
|
|
if m.Changed != 0 {
|
|
data[i] = 0x10
|
|
i++
|
|
i = encodeVarintDiff(data, i, uint64(m.Changed))
|
|
}
|
|
if m.Deleted != 0 {
|
|
data[i] = 0x18
|
|
i++
|
|
i = encodeVarintDiff(data, i, uint64(m.Deleted))
|
|
}
|
|
return i, nil
|
|
}
|
|
|
|
func encodeFixed64Diff(data []byte, offset int, v uint64) int {
|
|
data[offset] = uint8(v)
|
|
data[offset+1] = uint8(v >> 8)
|
|
data[offset+2] = uint8(v >> 16)
|
|
data[offset+3] = uint8(v >> 24)
|
|
data[offset+4] = uint8(v >> 32)
|
|
data[offset+5] = uint8(v >> 40)
|
|
data[offset+6] = uint8(v >> 48)
|
|
data[offset+7] = uint8(v >> 56)
|
|
return offset + 8
|
|
}
|
|
func encodeFixed32Diff(data []byte, offset int, v uint32) int {
|
|
data[offset] = uint8(v)
|
|
data[offset+1] = uint8(v >> 8)
|
|
data[offset+2] = uint8(v >> 16)
|
|
data[offset+3] = uint8(v >> 24)
|
|
return offset + 4
|
|
}
|
|
func encodeVarintDiff(data []byte, offset int, v uint64) int {
|
|
for v >= 1<<7 {
|
|
data[offset] = uint8(v&0x7f | 0x80)
|
|
v >>= 7
|
|
offset++
|
|
}
|
|
data[offset] = uint8(v)
|
|
return offset + 1
|
|
}
|
|
func (m *FileDiff) Size() (n int) {
|
|
var l int
|
|
_ = l
|
|
l = len(m.OrigName)
|
|
if l > 0 {
|
|
n += 1 + l + sovDiff(uint64(l))
|
|
}
|
|
if m.OrigTime != nil {
|
|
l = m.OrigTime.Size()
|
|
n += 1 + l + sovDiff(uint64(l))
|
|
}
|
|
l = len(m.NewName)
|
|
if l > 0 {
|
|
n += 1 + l + sovDiff(uint64(l))
|
|
}
|
|
if m.NewTime != nil {
|
|
l = m.NewTime.Size()
|
|
n += 1 + l + sovDiff(uint64(l))
|
|
}
|
|
if len(m.Extended) > 0 {
|
|
for _, s := range m.Extended {
|
|
l = len(s)
|
|
n += 1 + l + sovDiff(uint64(l))
|
|
}
|
|
}
|
|
if len(m.Hunks) > 0 {
|
|
for _, e := range m.Hunks {
|
|
l = e.Size()
|
|
n += 1 + l + sovDiff(uint64(l))
|
|
}
|
|
}
|
|
return n
|
|
}
|
|
|
|
func (m *Hunk) Size() (n int) {
|
|
var l int
|
|
_ = l
|
|
if m.OrigStartLine != 0 {
|
|
n += 1 + sovDiff(uint64(m.OrigStartLine))
|
|
}
|
|
if m.OrigLines != 0 {
|
|
n += 1 + sovDiff(uint64(m.OrigLines))
|
|
}
|
|
if m.OrigNoNewlineAt != 0 {
|
|
n += 1 + sovDiff(uint64(m.OrigNoNewlineAt))
|
|
}
|
|
if m.NewStartLine != 0 {
|
|
n += 1 + sovDiff(uint64(m.NewStartLine))
|
|
}
|
|
if m.NewLines != 0 {
|
|
n += 1 + sovDiff(uint64(m.NewLines))
|
|
}
|
|
l = len(m.Section)
|
|
if l > 0 {
|
|
n += 1 + l + sovDiff(uint64(l))
|
|
}
|
|
if m.StartPosition != 0 {
|
|
n += 1 + sovDiff(uint64(m.StartPosition))
|
|
}
|
|
if m.Body != nil {
|
|
l = len(m.Body)
|
|
if l > 0 {
|
|
n += 1 + l + sovDiff(uint64(l))
|
|
}
|
|
}
|
|
return n
|
|
}
|
|
|
|
func (m *Stat) Size() (n int) {
|
|
var l int
|
|
_ = l
|
|
if m.Added != 0 {
|
|
n += 1 + sovDiff(uint64(m.Added))
|
|
}
|
|
if m.Changed != 0 {
|
|
n += 1 + sovDiff(uint64(m.Changed))
|
|
}
|
|
if m.Deleted != 0 {
|
|
n += 1 + sovDiff(uint64(m.Deleted))
|
|
}
|
|
return n
|
|
}
|
|
|
|
func sovDiff(x uint64) (n int) {
|
|
for {
|
|
n++
|
|
x >>= 7
|
|
if x == 0 {
|
|
break
|
|
}
|
|
}
|
|
return n
|
|
}
|
|
func sozDiff(x uint64) (n int) {
|
|
return sovDiff(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
|
}
|
|
func (m *FileDiff) Unmarshal(data []byte) error {
|
|
l := len(data)
|
|
iNdEx := 0
|
|
for iNdEx < l {
|
|
preIndex := iNdEx
|
|
var wire uint64
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
wire |= (uint64(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
fieldNum := int32(wire >> 3)
|
|
wireType := int(wire & 0x7)
|
|
if wireType == 4 {
|
|
return fmt.Errorf("proto: FileDiff: wiretype end group for non-group")
|
|
}
|
|
if fieldNum <= 0 {
|
|
return fmt.Errorf("proto: FileDiff: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
}
|
|
switch fieldNum {
|
|
case 1:
|
|
if wireType != 2 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field OrigName", wireType)
|
|
}
|
|
var stringLen uint64
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
stringLen |= (uint64(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
intStringLen := int(stringLen)
|
|
if intStringLen < 0 {
|
|
return ErrInvalidLengthDiff
|
|
}
|
|
postIndex := iNdEx + intStringLen
|
|
if postIndex > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
m.OrigName = string(data[iNdEx:postIndex])
|
|
iNdEx = postIndex
|
|
case 2:
|
|
if wireType != 2 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field OrigTime", wireType)
|
|
}
|
|
var msglen int
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
msglen |= (int(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
if msglen < 0 {
|
|
return ErrInvalidLengthDiff
|
|
}
|
|
postIndex := iNdEx + msglen
|
|
if postIndex > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
if m.OrigTime == nil {
|
|
m.OrigTime = &pbtypes.Timestamp{}
|
|
}
|
|
if err := m.OrigTime.Unmarshal(data[iNdEx:postIndex]); err != nil {
|
|
return err
|
|
}
|
|
iNdEx = postIndex
|
|
case 3:
|
|
if wireType != 2 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field NewName", wireType)
|
|
}
|
|
var stringLen uint64
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
stringLen |= (uint64(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
intStringLen := int(stringLen)
|
|
if intStringLen < 0 {
|
|
return ErrInvalidLengthDiff
|
|
}
|
|
postIndex := iNdEx + intStringLen
|
|
if postIndex > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
m.NewName = string(data[iNdEx:postIndex])
|
|
iNdEx = postIndex
|
|
case 4:
|
|
if wireType != 2 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field NewTime", wireType)
|
|
}
|
|
var msglen int
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
msglen |= (int(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
if msglen < 0 {
|
|
return ErrInvalidLengthDiff
|
|
}
|
|
postIndex := iNdEx + msglen
|
|
if postIndex > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
if m.NewTime == nil {
|
|
m.NewTime = &pbtypes.Timestamp{}
|
|
}
|
|
if err := m.NewTime.Unmarshal(data[iNdEx:postIndex]); err != nil {
|
|
return err
|
|
}
|
|
iNdEx = postIndex
|
|
case 5:
|
|
if wireType != 2 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Extended", wireType)
|
|
}
|
|
var stringLen uint64
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
stringLen |= (uint64(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
intStringLen := int(stringLen)
|
|
if intStringLen < 0 {
|
|
return ErrInvalidLengthDiff
|
|
}
|
|
postIndex := iNdEx + intStringLen
|
|
if postIndex > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
m.Extended = append(m.Extended, string(data[iNdEx:postIndex]))
|
|
iNdEx = postIndex
|
|
case 6:
|
|
if wireType != 2 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Hunks", wireType)
|
|
}
|
|
var msglen int
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
msglen |= (int(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
if msglen < 0 {
|
|
return ErrInvalidLengthDiff
|
|
}
|
|
postIndex := iNdEx + msglen
|
|
if postIndex > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
m.Hunks = append(m.Hunks, &Hunk{})
|
|
if err := m.Hunks[len(m.Hunks)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
|
|
return err
|
|
}
|
|
iNdEx = postIndex
|
|
default:
|
|
iNdEx = preIndex
|
|
skippy, err := skipDiff(data[iNdEx:])
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if skippy < 0 {
|
|
return ErrInvalidLengthDiff
|
|
}
|
|
if (iNdEx + skippy) > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
iNdEx += skippy
|
|
}
|
|
}
|
|
|
|
if iNdEx > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
return nil
|
|
}
|
|
func (m *Hunk) Unmarshal(data []byte) error {
|
|
l := len(data)
|
|
iNdEx := 0
|
|
for iNdEx < l {
|
|
preIndex := iNdEx
|
|
var wire uint64
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
wire |= (uint64(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
fieldNum := int32(wire >> 3)
|
|
wireType := int(wire & 0x7)
|
|
if wireType == 4 {
|
|
return fmt.Errorf("proto: Hunk: wiretype end group for non-group")
|
|
}
|
|
if fieldNum <= 0 {
|
|
return fmt.Errorf("proto: Hunk: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
}
|
|
switch fieldNum {
|
|
case 1:
|
|
if wireType != 0 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field OrigStartLine", wireType)
|
|
}
|
|
m.OrigStartLine = 0
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
m.OrigStartLine |= (int32(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
case 2:
|
|
if wireType != 0 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field OrigLines", wireType)
|
|
}
|
|
m.OrigLines = 0
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
m.OrigLines |= (int32(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
case 3:
|
|
if wireType != 0 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field OrigNoNewlineAt", wireType)
|
|
}
|
|
m.OrigNoNewlineAt = 0
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
m.OrigNoNewlineAt |= (int32(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
case 4:
|
|
if wireType != 0 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field NewStartLine", wireType)
|
|
}
|
|
m.NewStartLine = 0
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
m.NewStartLine |= (int32(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
case 5:
|
|
if wireType != 0 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field NewLines", wireType)
|
|
}
|
|
m.NewLines = 0
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
m.NewLines |= (int32(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
case 6:
|
|
if wireType != 2 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Section", wireType)
|
|
}
|
|
var stringLen uint64
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
stringLen |= (uint64(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
intStringLen := int(stringLen)
|
|
if intStringLen < 0 {
|
|
return ErrInvalidLengthDiff
|
|
}
|
|
postIndex := iNdEx + intStringLen
|
|
if postIndex > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
m.Section = string(data[iNdEx:postIndex])
|
|
iNdEx = postIndex
|
|
case 7:
|
|
if wireType != 0 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field StartPosition", wireType)
|
|
}
|
|
m.StartPosition = 0
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
m.StartPosition |= (int32(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
case 8:
|
|
if wireType != 2 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType)
|
|
}
|
|
var byteLen int
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
byteLen |= (int(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
if byteLen < 0 {
|
|
return ErrInvalidLengthDiff
|
|
}
|
|
postIndex := iNdEx + byteLen
|
|
if postIndex > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
m.Body = append([]byte{}, data[iNdEx:postIndex]...)
|
|
iNdEx = postIndex
|
|
default:
|
|
iNdEx = preIndex
|
|
skippy, err := skipDiff(data[iNdEx:])
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if skippy < 0 {
|
|
return ErrInvalidLengthDiff
|
|
}
|
|
if (iNdEx + skippy) > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
iNdEx += skippy
|
|
}
|
|
}
|
|
|
|
if iNdEx > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
return nil
|
|
}
|
|
func (m *Stat) Unmarshal(data []byte) error {
|
|
l := len(data)
|
|
iNdEx := 0
|
|
for iNdEx < l {
|
|
preIndex := iNdEx
|
|
var wire uint64
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
wire |= (uint64(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
fieldNum := int32(wire >> 3)
|
|
wireType := int(wire & 0x7)
|
|
if wireType == 4 {
|
|
return fmt.Errorf("proto: Stat: wiretype end group for non-group")
|
|
}
|
|
if fieldNum <= 0 {
|
|
return fmt.Errorf("proto: Stat: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
}
|
|
switch fieldNum {
|
|
case 1:
|
|
if wireType != 0 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Added", wireType)
|
|
}
|
|
m.Added = 0
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
m.Added |= (int32(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
case 2:
|
|
if wireType != 0 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Changed", wireType)
|
|
}
|
|
m.Changed = 0
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
m.Changed |= (int32(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
case 3:
|
|
if wireType != 0 {
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Deleted", wireType)
|
|
}
|
|
m.Deleted = 0
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
m.Deleted |= (int32(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
default:
|
|
iNdEx = preIndex
|
|
skippy, err := skipDiff(data[iNdEx:])
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if skippy < 0 {
|
|
return ErrInvalidLengthDiff
|
|
}
|
|
if (iNdEx + skippy) > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
iNdEx += skippy
|
|
}
|
|
}
|
|
|
|
if iNdEx > l {
|
|
return io.ErrUnexpectedEOF
|
|
}
|
|
return nil
|
|
}
|
|
func skipDiff(data []byte) (n int, err error) {
|
|
l := len(data)
|
|
iNdEx := 0
|
|
for iNdEx < l {
|
|
var wire uint64
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return 0, ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return 0, io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
wire |= (uint64(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
wireType := int(wire & 0x7)
|
|
switch wireType {
|
|
case 0:
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return 0, ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return 0, io.ErrUnexpectedEOF
|
|
}
|
|
iNdEx++
|
|
if data[iNdEx-1] < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
return iNdEx, nil
|
|
case 1:
|
|
iNdEx += 8
|
|
return iNdEx, nil
|
|
case 2:
|
|
var length int
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return 0, ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return 0, io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
length |= (int(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
iNdEx += length
|
|
if length < 0 {
|
|
return 0, ErrInvalidLengthDiff
|
|
}
|
|
return iNdEx, nil
|
|
case 3:
|
|
for {
|
|
var innerWire uint64
|
|
var start int = iNdEx
|
|
for shift := uint(0); ; shift += 7 {
|
|
if shift >= 64 {
|
|
return 0, ErrIntOverflowDiff
|
|
}
|
|
if iNdEx >= l {
|
|
return 0, io.ErrUnexpectedEOF
|
|
}
|
|
b := data[iNdEx]
|
|
iNdEx++
|
|
innerWire |= (uint64(b) & 0x7F) << shift
|
|
if b < 0x80 {
|
|
break
|
|
}
|
|
}
|
|
innerWireType := int(innerWire & 0x7)
|
|
if innerWireType == 4 {
|
|
break
|
|
}
|
|
next, err := skipDiff(data[start:])
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
iNdEx = start + next
|
|
}
|
|
return iNdEx, nil
|
|
case 4:
|
|
return iNdEx, nil
|
|
case 5:
|
|
iNdEx += 4
|
|
return iNdEx, nil
|
|
default:
|
|
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
|
}
|
|
}
|
|
panic("unreachable")
|
|
}
|
|
|
|
var (
|
|
ErrInvalidLengthDiff = fmt.Errorf("proto: negative length found during unmarshaling")
|
|
ErrIntOverflowDiff = fmt.Errorf("proto: integer overflow")
|
|
)
|