Fix test, function name

This commit is contained in:
Chris Masone
2015-08-24 16:25:28 -07:00
parent 5f34469f22
commit 45a42976fc
4 changed files with 6 additions and 7 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ func main() {
newHead := source.Head().Ref()
refs := sync.DiffHeadsByRef(sink.Head().Ref(), newHead, source.Store())
sync.CopyChunks(refs, source.Store(), sink.Store())
for ok := false; !ok; *sink, ok = sync.SetNewHeads(newHead, *sink) {
for ok := false; !ok; *sink, ok = sync.SetNewHead(newHead, *sink) {
continue
}
+1 -2
View File
@@ -30,8 +30,7 @@ func TestDatasetCommitTracker(t *testing.T) {
assert.False(ds2.Head().Value().Equals(ds1Commit))
assert.False(ds1.Head().Value().Equals(ds2Commit))
// This changed because the code no longer creates an initial commit.
// assert.Equal("sha1-8aba7db6a2e7769afdb0b6ba3eabfe9b4624d83f", ms.Root().String())
assert.Equal("sha1-3c54d36480262f0626dd3706ebbdf7f791320cb0", ms.Root().String())
}
func TestExplicitBranchUsingDatasets(t *testing.T) {
+2 -2
View File
@@ -49,8 +49,8 @@ func CopyChunks(refs []ref.Ref, src chunks.ChunkSource, sink chunks.ChunkSink) {
return
}
// SetNewHeads takes the Ref of the desired new Heads of ds, the chunk for which should already exist in the Dataset. It validates that the Ref points to an existing chunk that decodes to the correct type of value and then commits it to ds, returning a new Dataset with newHeadRef set and ok set to true. In the event that the commit fails, ok is set to false and a new up-to-date Dataset is returned WITHOUT newHeadRef in it. The caller should try again using this new Dataset.
func SetNewHeads(newHeadRef ref.Ref, ds dataset.Dataset) (dataset.Dataset, bool) {
// SetNewHead takes the Ref of the desired new Heads of ds, the chunk for which should already exist in the Dataset. It validates that the Ref points to an existing chunk that decodes to the correct type of value and then commits it to ds, returning a new Dataset with newHeadRef set and ok set to true. In the event that the commit fails, ok is set to false and a new up-to-date Dataset is returned WITHOUT newHeadRef in it. The caller should try again using this new Dataset.
func SetNewHead(newHeadRef ref.Ref, ds dataset.Dataset) (dataset.Dataset, bool) {
commit := validateRefAsCommit(newHeadRef, ds.Store())
return ds.CommitWithParents(commit.Value(), datas.SetOfCommitFromVal(commit.Parents()))
}
+2 -2
View File
@@ -55,7 +55,7 @@ func TestPull(t *testing.T) {
refs := DiffHeadsByRef(puller.Head().Ref(), pullee.Head().Ref(), pullee.Store())
CopyChunks(refs, pullee.Store(), puller.Store())
puller, ok = SetNewHeads(pullee.Head().Ref(), puller)
puller, ok = SetNewHead(pullee.Head().Ref(), puller)
assert.True(ok)
assert.True(pullee.Head().Equals(puller.Head()))
}
@@ -83,7 +83,7 @@ func TestPullFirstCommit(t *testing.T) {
refs := DiffHeadsByRef(pullerHeadRef, pullee.Head().Ref(), pullee.Store())
CopyChunks(refs, pullee.Store(), puller.Store())
puller, ok = SetNewHeads(pullee.Head().Ref(), puller)
puller, ok = SetNewHead(pullee.Head().Ref(), puller)
assert.True(ok)
assert.True(pullee.Head().Equals(puller.Head()))