| Index: go/src/infra/libs/git/treeDiff.go
|
| diff --git a/go/src/infra/libs/git/treeDiff.go b/go/src/infra/libs/git/treeDiff.go
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..24bc4d457533f2dff065506b00255962d8245f6c
|
| --- /dev/null
|
| +++ b/go/src/infra/libs/git/treeDiff.go
|
| @@ -0,0 +1,44 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +package git
|
| +
|
| +import (
|
| + "fmt"
|
| +)
|
| +
|
| +// Types ///////////////////////////////////////////////////////////////////////
|
| +
|
| +// TreeDiff represents the difference between two Treeish objects
|
| +type TreeDiff []TreeDiffEntry
|
| +
|
| +// TreeDiffEntry represents the before and after of one path in the repo.
|
| +// Note that the Old.Name and New.Name may be different if this item was
|
| +// Moved or Copied.
|
| +type TreeDiffEntry struct {
|
| + // Action is one of "ACDMRTUX"
|
| + // U is for unmerged... if you're just comparing trees you should never see this
|
| + // X is probably a bug in git... you should also never see this.
|
| + // T is a type change, so if a tree turned into a blob, for example
|
| + Action string
|
| +
|
| + // For Action types 'R' or 'C', what percentage (from 0-100) are the old and
|
| + // new blobs similar.
|
| + Similarity int
|
| +
|
| + Old TreeDiffEntryHalf
|
| + New TreeDiffEntryHalf
|
| +}
|
| +
|
| +// TreeDiffEntryHalf is one entry in a TreeDiffEntry, either the Old or New half.
|
| +type TreeDiffEntryHalf struct {
|
| + Child
|
| + Name string
|
| +}
|
| +
|
| +// Member functions ////////////////////////////////////////////////////////////
|
| +
|
| +func (t *TreeDiffEntryHalf) String() string {
|
| + return fmt.Sprintf("%s: %s", t.Name, t.Child)
|
| +}
|
|
|