Navigate to snapshots from the transcript
This commit is contained in:
+13
-6
@@ -18,20 +18,27 @@ var statuses = map[byte]api.FileChangeStatus{
|
||||
}
|
||||
|
||||
func Changes(dir, defaultBranch, since string) (api.TaskChanges, error) {
|
||||
tree, err := Snapshot(dir)
|
||||
if err != nil {
|
||||
return api.TaskChanges{}, err
|
||||
}
|
||||
return Compare(dir, defaultBranch, "HEAD", tree, since)
|
||||
}
|
||||
|
||||
func Parent(dir, commit string) (string, error) {
|
||||
return run(dir, "rev-parse", "--verify", commit+"^")
|
||||
}
|
||||
|
||||
func Compare(dir, defaultBranch, head, tree, since string) (api.TaskChanges, error) {
|
||||
base := since
|
||||
if base == "" {
|
||||
mb, err := run(dir, "merge-base", "HEAD", defaultBranch)
|
||||
mb, err := run(dir, "merge-base", head, defaultBranch)
|
||||
if err != nil {
|
||||
return api.TaskChanges{}, err
|
||||
}
|
||||
base = mb
|
||||
}
|
||||
|
||||
tree, err := Snapshot(dir)
|
||||
if err != nil {
|
||||
return api.TaskChanges{}, err
|
||||
}
|
||||
|
||||
files, err := stats(dir, base, tree)
|
||||
if err != nil {
|
||||
return api.TaskChanges{}, err
|
||||
|
||||
Reference in New Issue
Block a user