Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Unified Diff: go/src/infra/libs/git/treeDiff.go

Issue 662113003: Drover's back, baby! (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git/+/master
Patch Set: more tests and refactors Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « go/src/infra/libs/git/tree.go ('k') | go/src/infra/libs/git/tree_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
+}
« no previous file with comments | « go/src/infra/libs/git/tree.go ('k') | go/src/infra/libs/git/tree_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698