-
Notifications
You must be signed in to change notification settings - Fork 268
Conversation
Once we integrate noms-merge into the `noms commit` command, this function will allow us to stop requiring users to pass in the common ancestor to be used when merging. The code can just find it and merge away. Toward attic-labs#2535
PTAL |
Current coverage is 81.51% (diff: 97.67%)
|
Instead of building Noms Sets out of parents and using an IntersectionIterator (overkill), make a Go map by TargetHash instead.
PTAL |
for i, r := range refs { | ||
vals[i] = r | ||
} | ||
return types.NewSet(vals...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As said IRL: try using TargetHash().String() of these refs and put in a Go map, not types.Set.
@@ -66,6 +68,50 @@ func CommitDescendsFrom(commit types.Struct, ancestor types.Ref, vr types.ValueR | |||
return true | |||
} | |||
|
|||
// FindCommonAncestor returns the most recent common ancestor of c1 and c2, if | |||
// one exists, setting ok to true. If there is no common ancestor, ok is set to false. | |||
func FindCommonAncestor(c1, c2 types.Struct, vr types.ValueReader) (a types.Struct, ok bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these structs because they are supposed to be Commits? Could you do d.PanicIfFalse(IsCommitType(c1.Type())
then?
(maybe we should add an IsCommitStruct so you don't need to call .Type())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
* 'master' of github.com:attic-labs/noms: (51 commits) Add unit tests for commit metadata (attic-labs#2595) Tweak the display of the type of an empty Map (attic-labs#2590) Remove TypeDesc equals (attic-labs#2584) Blackbg (attic-labs#2586) Make codecov Slack integration not emit 'template string' (attic-labs#2585) Go sequence interface/struct hierarchy refactor (attic-labs#2583) Update run_perf_builder.py to run 'go test' commands sequentially (attic-labs#2582) Add FindCommonAncestor for Commits (attic-labs#2579) Improve Go merge package code coverage (attic-labs#2581) Add code coverage to js/noms too (attic-labs#2580) Run python unittests; configure codecov via YAML (attic-labs#2578) Add codecov.io badge and submit coverage data from builds (attic-labs#2577) Add comment referencing potential infinite Commit loop (attic-labs#2576) Add link to download Noms binaries (attic-labs#2573) Add go/types/perf to perf build tests (oops) (attic-labs#2572) Support multiple perf datasets in the perf UI (attic-labs#2571) Add go/types to perf builder tests (attic-labs#2568) Build go binaries for multiple platforms (attic-labs#2564) Introduce List.Concat to the Go API (attic-labs#2550) Allow changes to different Datasets to proceed concurrently (attic-labs#2533) ...
Once we integrate noms-merge into the
noms commit
command, thisfunction will allow us to stop requiring users to pass in the common
ancestor to be used when merging. The code can just find it and merge
away.
Toward #2535