mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-08 02:36:27 -05:00
Merge pull request #6774 from dolthub/steph/pull
migrate dolt pull to use sql queries
This commit is contained in:
@@ -406,7 +406,7 @@ teardown() {
|
||||
dolt commit -m "added conflicting test row"
|
||||
dolt checkout main
|
||||
run dolt merge test-branch --no-commit
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content)" ]] || false
|
||||
run dolt conflicts cat test
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -450,7 +450,7 @@ teardown() {
|
||||
dolt commit -m "added conflicting test row"
|
||||
dolt checkout main
|
||||
run dolt merge test-branch --no-commit
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content)" ]] || false
|
||||
run dolt conflicts cat test
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -492,7 +492,9 @@ teardown() {
|
||||
dolt add test
|
||||
dolt commit -m "added conflicting test row"
|
||||
dolt checkout main
|
||||
dolt merge test-branch
|
||||
run dolt merge test-branch
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content)" ]] || false
|
||||
run dolt sql -q "select * from test"
|
||||
[[ "$output" =~ \|[[:space:]]+5 ]] || false
|
||||
run dolt conflicts cat test
|
||||
@@ -520,7 +522,9 @@ teardown() {
|
||||
dolt add test
|
||||
dolt commit -m "added conflicting test row"
|
||||
dolt checkout main
|
||||
dolt merge test-branch
|
||||
run dolt merge test-branch
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content)" ]] || false
|
||||
run dolt conflicts resolve --theirs test
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "" ]
|
||||
@@ -541,7 +545,9 @@ teardown() {
|
||||
dolt add test
|
||||
dolt commit -m "added conflicting test row"
|
||||
dolt checkout main
|
||||
dolt merge test-branch
|
||||
run dolt merge test-branch
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content)" ]] || false
|
||||
run dolt sql -q "call dolt_conflicts_resolve('--theirs', 'test')"
|
||||
[ "$status" -eq 0 ]
|
||||
run dolt sql -q "select * from test"
|
||||
|
||||
@@ -392,7 +392,9 @@ SQL
|
||||
# remove special characters (color)
|
||||
shaparent2=$(echo $shaparent2 | sed -E "s/[[:cntrl:]]\[[0-9]{1,3}m//g")
|
||||
|
||||
dolt merge test-branch
|
||||
run dolt merge test-branch
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
dolt conflicts resolve --theirs .
|
||||
dolt commit -m "final merge"
|
||||
|
||||
@@ -424,7 +426,10 @@ SQL
|
||||
# remove special characters (color)
|
||||
shaparent2=$(echo $shaparent2 | sed -E "s/[[:cntrl:]]\[[0-9]{1,3}m//g")
|
||||
|
||||
dolt merge test-branch
|
||||
run dolt merge test-branch
|
||||
[ "$status" -eq 1 ]
|
||||
echo "$output"
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
dolt conflicts resolve --theirs .
|
||||
dolt commit -m "final merge"
|
||||
|
||||
|
||||
@@ -103,7 +103,9 @@ SQL
|
||||
dolt commit -m "Added column c2 longtext"
|
||||
dolt checkout main
|
||||
dolt merge branch1
|
||||
dolt merge branch2
|
||||
run dolt merge branch2
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (schema):" ]] || false
|
||||
}
|
||||
|
||||
@test "column_tags: Merging branches that use the same tag referring to different column names fails" {
|
||||
@@ -128,7 +130,9 @@ SQL
|
||||
dolt commit -m "Added column c0 bigint"
|
||||
dolt checkout main
|
||||
dolt merge branch1
|
||||
dolt merge branch2
|
||||
run dolt merge branch2
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (schema):" ]] || false
|
||||
}
|
||||
|
||||
@test "column_tags: Merging branches that both created the same column succeeds" {
|
||||
|
||||
@@ -37,7 +37,9 @@ MODIFY COLUMN age BIGINT;
|
||||
SQL
|
||||
dolt commit -am "left"
|
||||
|
||||
dolt merge right -m "merge right"
|
||||
run dolt merge right -m "merge right"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (schema):" ]] || false
|
||||
|
||||
run dolt conflicts cat .
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -78,7 +80,9 @@ UPDATE t set col1 = 0 where pk = 3;
|
||||
INSERT INTO t VALUES (4, 4);
|
||||
SQL
|
||||
dolt commit -am 'left edit'
|
||||
dolt merge other -m "merge other"
|
||||
run dolt merge other -m "merge other"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
|
||||
# trick to disable colors
|
||||
dolt conflicts cat . > output.txt
|
||||
@@ -112,7 +116,9 @@ SQL
|
||||
dolt sql -q "INSERT INTO t values (1, 3);"
|
||||
dolt commit -am "left"
|
||||
|
||||
dolt merge right -m "merge right"
|
||||
run dolt merge right -m "merge right"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
|
||||
run dolt conflicts cat .
|
||||
[[ "$output" =~ "| a" ]] || false
|
||||
@@ -135,7 +141,9 @@ ALTER TABLE t ADD c INT;
|
||||
INSERT INTO t VALUES (1, 3, 1);
|
||||
SQL
|
||||
dolt commit -am "left"
|
||||
dolt merge right -m "merge left"
|
||||
run dolt merge right -m "merge left"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
|
||||
run dolt conflicts cat .
|
||||
[[ "$output" =~ "| a" ]] || false
|
||||
|
||||
@@ -399,7 +399,7 @@ SQL
|
||||
|
||||
dolt checkout -b merge-into-modified modifier
|
||||
run dolt merge deleter -m "merge"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
dolt merge --abort
|
||||
|
||||
@@ -407,7 +407,9 @@ SQL
|
||||
dolt checkout main
|
||||
dolt branch -d -f merge-into-modified
|
||||
dolt checkout -b merge-into-modified modifier
|
||||
dolt merge deleter -m "merge"
|
||||
run dolt merge deleter -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
|
||||
dolt conflicts resolve --theirs foo
|
||||
run dolt sql -q 'select count(*) from foo'
|
||||
@@ -420,7 +422,9 @@ SQL
|
||||
dolt checkout main
|
||||
dolt branch -d -f merge-into-modified
|
||||
dolt checkout -b merge-into-modified modifier
|
||||
dolt merge deleter -m "merge"
|
||||
run dolt merge deleter -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
dolt conflicts resolve --ours foo
|
||||
run dolt sql -q 'select count(*) from foo'
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -430,7 +434,7 @@ SQL
|
||||
|
||||
dolt checkout -b merge-into-deleter deleter
|
||||
run dolt merge modifier -m "merge"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
dolt merge --abort
|
||||
|
||||
@@ -438,7 +442,9 @@ SQL
|
||||
dolt checkout main
|
||||
dolt branch -d -f merge-into-deleter
|
||||
dolt checkout -b merge-into-deleter deleter
|
||||
dolt merge modifier -m "merge"
|
||||
run dolt merge modifier -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
dolt conflicts resolve --ours foo
|
||||
run dolt sql -q 'select count(*) from foo'
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -450,7 +456,9 @@ SQL
|
||||
dolt checkout main
|
||||
dolt branch -d -f merge-into-deleter
|
||||
dolt checkout -b merge-into-deleter deleter
|
||||
dolt merge modifier -m "merge"
|
||||
run dolt merge modifier -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
dolt conflicts resolve --theirs foo
|
||||
run dolt sql -q 'select count(*) from foo'
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -477,7 +485,7 @@ SQL
|
||||
|
||||
dolt checkout -b merge-into-modified modifier
|
||||
run dolt merge deleter -m "merge"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
dolt merge --abort
|
||||
|
||||
@@ -485,7 +493,9 @@ SQL
|
||||
dolt checkout main
|
||||
dolt branch -d -f merge-into-modified
|
||||
dolt checkout -b merge-into-modified modifier
|
||||
dolt merge deleter -m "merge"
|
||||
run dolt merge deleter -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
|
||||
dolt sql -q "call dolt_conflicts_resolve('--theirs', 'foo')"
|
||||
run dolt sql -q 'select count(*) from foo'
|
||||
@@ -498,7 +508,9 @@ SQL
|
||||
dolt checkout main
|
||||
dolt branch -d -f merge-into-modified
|
||||
dolt checkout -b merge-into-modified modifier
|
||||
dolt merge deleter -m "merge"
|
||||
run dolt merge deleter -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
dolt sql -q "call dolt_conflicts_resolve('--ours', 'foo')"
|
||||
run dolt sql -q 'select count(*) from foo'
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -508,7 +520,7 @@ SQL
|
||||
|
||||
dolt checkout -b merge-into-deleter deleter
|
||||
run dolt merge modifier -m "merge"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
dolt merge --abort
|
||||
|
||||
@@ -516,7 +528,9 @@ SQL
|
||||
dolt checkout main
|
||||
dolt branch -d -f merge-into-deleter
|
||||
dolt checkout -b merge-into-deleter deleter
|
||||
dolt merge modifier -m "merge"
|
||||
run dolt merge modifier -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
dolt sql -q "call dolt_conflicts_resolve('--ours', 'foo')"
|
||||
run dolt sql -q 'select count(*) from foo'
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -528,7 +542,9 @@ SQL
|
||||
dolt checkout main
|
||||
dolt branch -d -f merge-into-deleter
|
||||
dolt checkout -b merge-into-deleter deleter
|
||||
dolt merge modifier -m "merge"
|
||||
run dolt merge modifier -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
dolt sql -q "call dolt_conflicts_resolve('--theirs', 'foo')"
|
||||
run dolt sql -q 'select count(*) from foo'
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -586,7 +602,9 @@ SQL
|
||||
dolt add .
|
||||
dolt commit -m "inserted 0,1"
|
||||
dolt checkout main
|
||||
dolt merge branch1 -m "merge"
|
||||
run dolt merge branch1 -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
dolt conflicts resolve --ours test
|
||||
|
||||
run dolt conflicts cat test
|
||||
@@ -626,7 +644,9 @@ SQL
|
||||
dolt add .
|
||||
dolt commit -m "inserted 0,1"
|
||||
dolt checkout main
|
||||
dolt merge branch1 -m "merge"
|
||||
run dolt merge branch1 -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
run dolt sql -q "call dolt_conflicts_resolve('--ours', 'test')"
|
||||
[ $status -eq 0 ]
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ SQL
|
||||
dolt commit -m "changed pk=0 all cells to 11"
|
||||
dolt checkout main
|
||||
run dolt merge change-cell -m "merge"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
run dolt status
|
||||
[[ "$output" =~ "You have unmerged tables." ]] || false
|
||||
|
||||
@@ -89,7 +89,7 @@ teardown() {
|
||||
[[ $output =~ "main" ]] || false
|
||||
|
||||
run dolt merge other
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "Automatic merge failed" ]] || false
|
||||
|
||||
run dolt conflicts resolve --ours .
|
||||
@@ -108,7 +108,7 @@ teardown() {
|
||||
[[ $output =~ "main" ]] || false
|
||||
|
||||
run dolt merge other
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "Automatic merge failed" ]] || false
|
||||
|
||||
run dolt conflicts resolve --ours t
|
||||
@@ -127,7 +127,7 @@ teardown() {
|
||||
[[ $output =~ "main" ]] || false
|
||||
|
||||
run dolt merge other
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "Automatic merge failed" ]] || false
|
||||
|
||||
run dolt conflicts resolve --theirs .
|
||||
@@ -146,7 +146,7 @@ teardown() {
|
||||
[[ $output =~ "main" ]] || false
|
||||
|
||||
run dolt merge other
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "Automatic merge failed" ]] || false
|
||||
|
||||
run dolt conflicts resolve --theirs t
|
||||
@@ -165,7 +165,7 @@ teardown() {
|
||||
[[ $output =~ "other" ]] || false
|
||||
|
||||
run dolt merge main
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "Automatic merge failed" ]] || false
|
||||
|
||||
run dolt conflicts resolve --ours .
|
||||
@@ -184,7 +184,7 @@ teardown() {
|
||||
[[ $output =~ "other" ]] || false
|
||||
|
||||
run dolt merge main
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "Automatic merge failed" ]] || false
|
||||
|
||||
run dolt conflicts resolve --ours t
|
||||
@@ -203,7 +203,7 @@ teardown() {
|
||||
[[ $output =~ "other" ]] || false
|
||||
|
||||
run dolt merge main
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "Automatic merge failed" ]] || false
|
||||
|
||||
run dolt conflicts resolve --theirs .
|
||||
@@ -222,7 +222,7 @@ teardown() {
|
||||
[[ $output =~ "other" ]] || false
|
||||
|
||||
run dolt merge main
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "Automatic merge failed" ]] || false
|
||||
|
||||
run dolt conflicts resolve --theirs t
|
||||
|
||||
@@ -28,7 +28,7 @@ SQL
|
||||
dolt checkout main
|
||||
|
||||
run dolt merge other
|
||||
log_status_eq "0"
|
||||
log_status_eq "1"
|
||||
[[ "$output" =~ "Fix constraint violations" ]] || false
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -58,7 +58,7 @@ SQL
|
||||
dolt commit -m "this works"
|
||||
run dolt merge other
|
||||
log_status_eq "0"
|
||||
[[ "$output" =~ "up to date" ]] || false
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
}
|
||||
|
||||
@test "constraint-violations: dolt_force_transaction_commit along with dolt_allow_commit_conflicts ignores constraint violations" {
|
||||
@@ -111,7 +111,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -158,7 +160,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -212,7 +216,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -265,7 +271,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -321,7 +329,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit --force -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -372,7 +382,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit --force -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -421,7 +433,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -468,7 +482,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -521,7 +537,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -574,7 +592,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -630,7 +650,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit --force -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -681,7 +703,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit --force -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -730,7 +754,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -777,7 +803,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -830,7 +858,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -883,7 +913,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -939,7 +971,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit --force -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -990,7 +1024,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit --force -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1134,7 +1170,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1184,7 +1222,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1238,7 +1278,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1294,7 +1336,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1351,7 +1395,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit --force -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1403,7 +1449,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit --force -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1455,7 +1503,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1505,7 +1555,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1559,7 +1611,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1615,7 +1669,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1672,7 +1728,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit --force -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1724,7 +1782,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit --force -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1776,7 +1836,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1826,7 +1888,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1880,7 +1944,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1936,7 +2002,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -1993,7 +2061,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit --force -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -2045,7 +2115,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit --force -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -2096,7 +2168,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -2145,7 +2219,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -2194,7 +2270,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -2242,7 +2320,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -2290,7 +2370,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -2338,7 +2420,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -2390,7 +2474,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit --force -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -2441,7 +2527,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -2501,7 +2589,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -2561,7 +2651,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -2622,7 +2714,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -2779,7 +2873,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -2816,7 +2912,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "OC1"
|
||||
dolt checkout main
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
log_status_eq "0"
|
||||
@@ -2857,7 +2955,7 @@ CALL DOLT_COMMIT('-am', 'add unique key constraint');
|
||||
CALL DOLT_CHECKOUT('main');
|
||||
SQL
|
||||
run dolt merge right
|
||||
log_status_eq 0
|
||||
log_status_eq 1
|
||||
[[ $output =~ "CONSTRAINT VIOLATION (content): Merge created constraint violation in t" ]] || false
|
||||
[[ $output =~ "Automatic merge failed; 1 table(s) are unmerged." ]] || false
|
||||
}
|
||||
|
||||
@@ -3,24 +3,24 @@ load $BATS_TEST_DIRNAME/helper/common.bash
|
||||
|
||||
setup() {
|
||||
setup_common
|
||||
TMPDIRS=$(pwd)/tmpdirs
|
||||
mkdir -p $TMPDIRS/{rem1,repo1}
|
||||
TESTDIRS=$(pwd)/testdirs
|
||||
mkdir -p $TESTDIRS/{rem1,repo1}
|
||||
|
||||
# repo1 -> rem1 -> repo2
|
||||
cd $TMPDIRS/repo1
|
||||
cd $TESTDIRS/repo1
|
||||
dolt init
|
||||
dolt remote add origin file://../rem1
|
||||
dolt remote add test-remote file://../rem1
|
||||
dolt push origin main
|
||||
|
||||
cd $TMPDIRS
|
||||
cd $TESTDIRS
|
||||
dolt clone file://rem1 repo2
|
||||
cd $TMPDIRS/repo2
|
||||
cd $TESTDIRS/repo2
|
||||
dolt branch feature
|
||||
dolt remote add test-remote file://../rem1
|
||||
|
||||
# table and commits only present on repo1, rem1 at start
|
||||
cd $TMPDIRS/repo1
|
||||
cd $TESTDIRS/repo1
|
||||
dolt sql -q "create table t1 (a int primary key, b int)"
|
||||
dolt add .
|
||||
dolt commit -am "First commit"
|
||||
@@ -28,13 +28,12 @@ setup() {
|
||||
dolt commit -am "Second commit"
|
||||
dolt branch feature
|
||||
dolt push origin main
|
||||
cd $TMPDIRS
|
||||
cd $TESTDIRS
|
||||
}
|
||||
|
||||
teardown() {
|
||||
teardown_common
|
||||
rm -rf $TMPDIRS
|
||||
cd $BATS_TMPDIR
|
||||
rm -rf $TESTDIRS
|
||||
}
|
||||
|
||||
@test "fetch: basic fetch" {
|
||||
|
||||
@@ -1121,7 +1121,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit --force -m "updated parent"
|
||||
dolt checkout main
|
||||
dolt merge other -m "merge other"
|
||||
run dolt merge other -m "merge other"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
[ "$status" -eq "0" ]
|
||||
[[ "$output" =~ "table,num_violations" ]] || false
|
||||
@@ -1197,7 +1199,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit --force -m "updated child"
|
||||
dolt checkout main
|
||||
dolt merge other -m "merge other"
|
||||
run dolt merge other -m "merge other"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
[ "$status" -eq "0" ]
|
||||
[[ "$output" =~ "table,num_violations" ]] || false
|
||||
@@ -1276,7 +1280,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit --force -m "updated both"
|
||||
dolt checkout main
|
||||
dolt merge other -m "merge other"
|
||||
run dolt merge other -m "merge other"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
[ "$status" -eq "0" ]
|
||||
[[ "$output" =~ "table,num_violations" ]] || false
|
||||
@@ -1306,7 +1312,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "added 2s"
|
||||
dolt checkout main
|
||||
dolt merge other -m "merge other"
|
||||
run dolt merge other -m "merge other"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
run dolt conflicts resolve --theirs parent
|
||||
[ "$status" -eq "1" ]
|
||||
[[ "$output" =~ "violation" ]] || false
|
||||
@@ -1338,7 +1346,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "added 2s"
|
||||
dolt checkout main
|
||||
dolt merge other -m "merge other"
|
||||
run dolt merge other -m "merge other"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
run dolt sql <<SQL
|
||||
set @@dolt_allow_commit_conflicts = 1;
|
||||
call dolt_conflicts_resolve('--theirs', 'parent');
|
||||
|
||||
@@ -195,7 +195,9 @@ setup_merge_with_cv() {
|
||||
|
||||
@test "garbage_collection: leave conflicts" {
|
||||
setup_merge
|
||||
dolt merge other -m "merge"
|
||||
run dolt merge other -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
|
||||
run dolt sql -r csv -q "select base_pk, base_c0, our_pk, our_c0, their_pk, their_c0 from dolt_conflicts_test;"
|
||||
[ $status -eq 0 ]
|
||||
@@ -214,7 +216,9 @@ setup_merge_with_cv() {
|
||||
|
||||
@test "garbage_collection: leave constraint violations" {
|
||||
setup_merge_with_cv
|
||||
dolt merge other -m "merge"
|
||||
run dolt merge other -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
|
||||
run dolt sql -r csv -q "select pk, fk from dolt_constraint_violations_child;"
|
||||
[ $status -eq 0 ]
|
||||
@@ -229,7 +233,9 @@ setup_merge_with_cv() {
|
||||
|
||||
@test "garbage_collection: leave merge commit" {
|
||||
setup_merge
|
||||
dolt merge other -m "merge"
|
||||
run dolt merge other -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
|
||||
dolt gc
|
||||
|
||||
@@ -246,7 +252,9 @@ setup_merge_with_cv() {
|
||||
|
||||
@test "garbage_collection: leave merge commit with stored procedure" {
|
||||
setup_merge
|
||||
dolt merge other -m "merge"
|
||||
run dolt merge other -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
|
||||
dolt gc
|
||||
|
||||
@@ -267,7 +275,9 @@ setup_merge_with_cv() {
|
||||
# make a dirty working set with table quiz
|
||||
dolt sql -q "INSERT INTO quiz VALUES (9,99)"
|
||||
|
||||
dolt merge other -m "merge"
|
||||
run dolt merge other -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
dolt gc
|
||||
run dolt merge --abort
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -21,7 +21,6 @@ SKIP_SERVER_TESTS=$(cat <<-EOM
|
||||
~sql-local-remote.bats~
|
||||
~1pk5col-strings.bats~
|
||||
~sql-tags.bats~
|
||||
~sql-pull.bats~
|
||||
~empty-repo.bats~
|
||||
~verify-constraints.bats~
|
||||
~db-revision-specifiers.bats~
|
||||
|
||||
@@ -2196,7 +2196,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "other changes"
|
||||
dolt checkout main
|
||||
dolt merge other -m "merge"
|
||||
run dolt merge other -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
run dolt index cat onepk idx_v1 -r=csv
|
||||
[ "$status" -eq "0" ]
|
||||
[[ "$output" =~ "v1,pk1" ]] || false
|
||||
@@ -2232,7 +2234,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "other changes"
|
||||
dolt checkout main
|
||||
dolt merge other -m "merge"
|
||||
run dolt merge other -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
dolt conflicts resolve --ours onepk
|
||||
run dolt index cat onepk idx_v1 -r=csv
|
||||
[ "$status" -eq "0" ]
|
||||
@@ -2259,7 +2263,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "other changes"
|
||||
dolt checkout main
|
||||
dolt merge other -m "merge"
|
||||
run dolt merge other -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
dolt sql -q "call dolt_conflicts_resolve('--ours', 'onepk')"
|
||||
run dolt index cat onepk idx_v1 -r=csv
|
||||
[ "$status" -eq "0" ]
|
||||
@@ -2287,7 +2293,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "other changes"
|
||||
dolt checkout main
|
||||
dolt merge other -m "merge"
|
||||
run dolt merge other -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
dolt conflicts resolve --theirs onepk
|
||||
run dolt index cat onepk idx_v1 -r=csv
|
||||
[ "$status" -eq "0" ]
|
||||
@@ -2314,7 +2322,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "other changes"
|
||||
dolt checkout main
|
||||
dolt merge other -m "merge"
|
||||
run dolt merge other -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
dolt sql -q "call dolt_conflicts_resolve('--theirs', 'onepk')"
|
||||
run dolt index cat onepk idx_v1 -r=csv
|
||||
[ "$status" -eq "0" ]
|
||||
@@ -2342,7 +2352,9 @@ SQL
|
||||
dolt add -A
|
||||
dolt commit -m "other changes"
|
||||
dolt checkout main
|
||||
dolt merge other -m "merge"
|
||||
run dolt merge other -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content):" ]] || false
|
||||
run dolt sql <<SQL
|
||||
SET dolt_allow_commit_conflicts = on;
|
||||
DELETE from dolt_conflicts_onepk where our_pk1 = 4;
|
||||
@@ -2379,7 +2391,9 @@ SQL
|
||||
|
||||
dolt checkout main
|
||||
|
||||
dolt merge other -m "merge"
|
||||
run dolt merge other -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION (content):" ]] || false
|
||||
run dolt sql -q "SELECT * FROM dolt_constraint_violations" -r=csv
|
||||
[ "$status" -eq "0" ]
|
||||
[[ "$output" =~ "table,num_violations" ]] || false
|
||||
|
||||
@@ -163,7 +163,7 @@ SQL
|
||||
dolt commit -am "made changes on branch another"
|
||||
|
||||
run dolt merge other -m "merge"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
run dolt conflicts resolve --ours js
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -213,7 +213,7 @@ SQL
|
||||
dolt commit -am "made changes on branch another"
|
||||
|
||||
run dolt merge other -m "merge"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
run dolt sql -q "call dolt_conflicts_resolve('--ours', 'js')"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -159,7 +159,7 @@ SQL
|
||||
dolt commit -am "made changes on branch another"
|
||||
|
||||
run dolt merge other -m "merge"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
run dolt conflicts resolve --ours js
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -209,7 +209,7 @@ SQL
|
||||
dolt commit -am "made changes on branch another"
|
||||
|
||||
run dolt merge other -m "merge"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
run dolt sql -q "call dolt_conflicts_resolve('--ours', 'js')"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -305,7 +305,7 @@ SQL
|
||||
dolt commit -am "inserted on other"
|
||||
|
||||
run dolt merge main
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
run dolt sql -q "SELECT * FROM keyless WHERE c0 > 6 ORDER BY c0;" -r csv
|
||||
[ $status -eq 0 ]
|
||||
[[ "${lines[1]}" = "7,7" ]] || false
|
||||
@@ -414,7 +414,7 @@ SQL
|
||||
dolt commit -am "deleted four rows on left"
|
||||
|
||||
run dolt merge right -m "merge"
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
|
||||
run dolt conflicts resolve --ours dupe
|
||||
@@ -439,7 +439,7 @@ SQL
|
||||
dolt commit -am "deleted four rows on left"
|
||||
|
||||
run dolt merge right -m "merge"
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
|
||||
run dolt sql -q "call dolt_conflicts_resolve('--ours', 'dupe')"
|
||||
@@ -487,7 +487,7 @@ SQL
|
||||
dolt commit -am "updated four rows on left"
|
||||
|
||||
run dolt merge right -m "merge"
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
|
||||
run dolt conflicts resolve --theirs dupe
|
||||
@@ -512,7 +512,7 @@ SQL
|
||||
dolt commit -am "updated four rows on left"
|
||||
|
||||
run dolt merge right -m "merge"
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
|
||||
run dolt sql -q "call dolt_conflicts_resolve('--theirs', 'dupe')"
|
||||
@@ -676,7 +676,7 @@ CSV
|
||||
dolt commit -am "updated on other"
|
||||
|
||||
run dolt merge main -m "merge"
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
|
||||
run dolt conflicts resolve --ours keyless
|
||||
@@ -723,7 +723,7 @@ CSV
|
||||
dolt commit -am "inserted on other"
|
||||
|
||||
run dolt merge main -m "merge"
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
run dolt sql -q "SELECT count(*) FROM keyless WHERE c0 > 6;" -r csv
|
||||
[ $status -eq 0 ]
|
||||
[[ "${lines[1]}" = "3" ]] || false
|
||||
@@ -770,7 +770,7 @@ SQL
|
||||
dolt commit -am "inserted on other"
|
||||
|
||||
run dolt merge main -m "merge"
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
|
||||
run dolt conflicts resolve --theirs keyless
|
||||
@@ -798,7 +798,7 @@ SQL
|
||||
dolt commit -am "inserted on other"
|
||||
|
||||
run dolt merge main -m "merge"
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
|
||||
run dolt sql -q "call dolt_conflicts_resolve('--theirs', 'keyless')"
|
||||
@@ -838,7 +838,7 @@ SQL
|
||||
dolt commit -am "inserted on other"
|
||||
|
||||
run dolt merge main -m "merge"
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
|
||||
run dolt conflicts resolve --ours keyless
|
||||
@@ -863,7 +863,7 @@ SQL
|
||||
dolt commit -am "inserted on other"
|
||||
|
||||
run dolt merge main -m "merge"
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
|
||||
run dolt sql -q "call dolt_conflicts_resolve('--ours', 'keyless')"
|
||||
@@ -921,7 +921,7 @@ SQL
|
||||
dolt commit -am "inserted twos on left"
|
||||
|
||||
run dolt merge right -m "merge"
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
|
||||
run dolt conflicts resolve --theirs keyless
|
||||
@@ -947,7 +947,7 @@ SQL
|
||||
dolt commit -am "inserted twos on left"
|
||||
|
||||
run dolt merge right -m "merge"
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
|
||||
run dolt sql -q "call dolt_conflicts_resolve('--theirs', 'keyless')"
|
||||
|
||||
@@ -144,7 +144,9 @@ SQL
|
||||
# dirty the working set with changes to test2
|
||||
dolt sql -q "INSERT INTO test2 VALUES (9,9,9);"
|
||||
|
||||
dolt merge other --no-commit
|
||||
run dolt merge other --no-commit
|
||||
log_status_eq 1
|
||||
[[ "$output" =~ "Automatic merge failed" ]] || false
|
||||
dolt merge --abort
|
||||
|
||||
run dolt sql -q "SELECT * from dolt_merge_status"
|
||||
@@ -257,7 +259,8 @@ SQL
|
||||
dolt commit -m "add pk 0 = 2,2 to test1"
|
||||
|
||||
run dolt merge merge_branch -m "merge_branch"
|
||||
log_status_eq 0
|
||||
log_status_eq 1
|
||||
[[ "$output" =~ "Automatic merge failed" ]] || false
|
||||
[[ "$output" =~ "test1" ]] || false
|
||||
|
||||
dolt add test1
|
||||
@@ -286,7 +289,8 @@ SQL
|
||||
dolt commit -m "add pk 0 = 2,2 to test1"
|
||||
|
||||
run dolt merge merge_branch --no-commit
|
||||
log_status_eq 0
|
||||
log_status_eq 1
|
||||
[[ "$output" =~ "Automatic merge failed" ]] || false
|
||||
[[ "$output" =~ "test1" ]] || false
|
||||
|
||||
run dolt commit -m 'create a merge commit'
|
||||
@@ -533,7 +537,8 @@ SQL
|
||||
dolt commit -am "added row"
|
||||
|
||||
run dolt merge other
|
||||
log_status_eq 0
|
||||
log_status_eq 1
|
||||
[[ "$output" =~ "Automatic merge failed" ]] || false
|
||||
|
||||
run dolt sql -q "select * from dolt_constraint_violations" -r=csv
|
||||
[[ "$output" =~ "test,2" ]] || false
|
||||
@@ -773,10 +778,13 @@ SQL
|
||||
dolt commit -am "non-fk insert"
|
||||
|
||||
dolt checkout main
|
||||
dolt merge right
|
||||
run dolt merge right
|
||||
log_status_eq 1
|
||||
[[ "$output" =~ "Automatic merge failed" ]] || false
|
||||
dolt commit -afm "commit constraint violations"
|
||||
|
||||
dolt merge other --no-commit
|
||||
run dolt merge other --no-commit
|
||||
[[ "$output" =~ "Automatic merge failed" ]] || false
|
||||
|
||||
run dolt sql -r csv -q "SELECT violation_type, pk, parent_fk from dolt_constraint_violations_child;";
|
||||
[[ "${lines[1]}" = "foreign key,1,1" ]] || false
|
||||
@@ -827,7 +835,8 @@ SQL
|
||||
dolt commit -afm "committing merge conflicts"
|
||||
|
||||
# merge should be allowed and previous conflicts and violations should be retained
|
||||
dolt merge other2 --no-commit
|
||||
run dolt merge other2 --no-commit
|
||||
[[ "$output" =~ "Automatic merge failed" ]] || false
|
||||
run dolt sql -r csv -q "SELECT * FROM parent;"
|
||||
[[ "${lines[1]}" = "1,2" ]] || false
|
||||
[[ "${lines[2]}" = "3,1" ]] || false
|
||||
@@ -869,7 +878,7 @@ SQL
|
||||
|
||||
# Create a conflicted state by merging other into main
|
||||
run dolt merge other
|
||||
log_status_eq 0
|
||||
log_status_eq 1
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
|
||||
run dolt sql -r csv -q "SELECT * FROM parent;"
|
||||
@@ -971,7 +980,7 @@ SQL
|
||||
dolt checkout main
|
||||
run dolt merge other --no-commit --commit
|
||||
log_status_eq 1
|
||||
[[ "$output" =~ "cannot define both 'commit' and 'no-commit' flags at the same time" ]] || false
|
||||
[[ "$output" =~ "Flags '--commit' and '--no-commit' cannot be used together" ]] || false
|
||||
|
||||
run dolt merge other --no-commit
|
||||
log_status_eq 0
|
||||
|
||||
Executable
+455
@@ -0,0 +1,455 @@
|
||||
#!/usr/bin/env bats
|
||||
load $BATS_TEST_DIRNAME/helper/common.bash
|
||||
|
||||
setup() {
|
||||
setup_common
|
||||
|
||||
TESTDIRS=$(pwd)/testdirs
|
||||
mkdir -p $TESTDIRS/{rem1,repo1}
|
||||
|
||||
# repo1 -> rem1 -> repo2
|
||||
cd $TESTDIRS/repo1
|
||||
dolt init
|
||||
dolt branch feature
|
||||
dolt remote add origin file://../rem1
|
||||
dolt remote add test-remote file://../rem1
|
||||
dolt push origin main
|
||||
|
||||
cd $TESTDIRS
|
||||
dolt clone file://rem1 repo2
|
||||
cd $TESTDIRS/repo2
|
||||
dolt log
|
||||
dolt branch feature
|
||||
dolt remote add test-remote file://../rem1
|
||||
|
||||
# table and commits only present on repo1, rem1 at start
|
||||
cd $TESTDIRS/repo1
|
||||
dolt sql -q "create table t1 (a int primary key, b int)"
|
||||
dolt add .
|
||||
dolt commit -am "First commit"
|
||||
dolt sql -q "insert into t1 values (0,0)"
|
||||
dolt commit -am "Second commit"
|
||||
dolt push origin main
|
||||
cd $TESTDIRS
|
||||
}
|
||||
|
||||
teardown() {
|
||||
teardown_common
|
||||
rm -rf $TESTDIRS
|
||||
}
|
||||
|
||||
@test "pull: pull main" {
|
||||
cd repo2
|
||||
dolt pull origin
|
||||
run dolt sql -q "show tables" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
[[ "$output" =~ "Table" ]] || false
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
run dolt log
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "First commit" ]] || false
|
||||
[[ "$output" =~ "Second commit" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: pull custom remote" {
|
||||
cd repo2
|
||||
dolt pull test-remote
|
||||
run dolt sql -q "show tables" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
[[ "$output" =~ "Table" ]] || false
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
run dolt log
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "First commit" ]] || false
|
||||
[[ "$output" =~ "Second commit" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: pull default origin" {
|
||||
cd repo2
|
||||
dolt remote remove test-remote
|
||||
dolt pull
|
||||
run dolt sql -q "show tables" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
[[ "$output" =~ "Table" ]] || false
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
run dolt log
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "First commit" ]] || false
|
||||
[[ "$output" =~ "Second commit" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: pull default custom remote" {
|
||||
cd repo2
|
||||
dolt remote remove origin
|
||||
dolt pull
|
||||
run dolt sql -q "show tables" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
[[ "$output" =~ "Table" ]] || false
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
run dolt log
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "First commit" ]] || false
|
||||
[[ "$output" =~ "Second commit" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: pull up to date does not error" {
|
||||
cd repo2
|
||||
dolt pull origin
|
||||
run dolt pull origin
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
|
||||
run dolt sql -q "show tables" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
[[ "$output" =~ "Table" ]] || false
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: pull unknown remote fails" {
|
||||
cd repo2
|
||||
run dolt pull unknown
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "unknown remote" ]] || false
|
||||
[[ ! "$output" =~ "panic" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: pull unknown feature branch fails" {
|
||||
cd repo2
|
||||
dolt checkout feature
|
||||
run dolt pull origin
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "You asked to pull from the remote 'origin', but did not specify a branch" ]] || false
|
||||
[[ ! "$output" =~ "panic" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: pull feature branch" {
|
||||
cd repo1
|
||||
dolt checkout feature
|
||||
dolt push --set-upstream origin feature
|
||||
|
||||
cd ../repo2
|
||||
dolt checkout feature
|
||||
dolt push --set-upstream origin feature
|
||||
|
||||
cd ../repo1
|
||||
dolt merge main
|
||||
dolt push
|
||||
|
||||
cd ../repo2
|
||||
dolt pull origin
|
||||
run dolt sql -q "show tables" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
[[ "$output" =~ "Table" ]] || false
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
run dolt log
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "First commit" ]] || false
|
||||
[[ "$output" =~ "Second commit" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: checkout after fetch a new feature branch" {
|
||||
cd repo1
|
||||
dolt checkout -b feature2
|
||||
dolt sql -q "create table t2 (i int primary key);"
|
||||
dolt sql -q "call dolt_add('.');"
|
||||
dolt sql -q "call dolt_commit('-am', 'create t2')"
|
||||
dolt push --set-upstream origin feature2
|
||||
|
||||
cd ../repo2
|
||||
dolt fetch origin feature2
|
||||
dolt checkout feature2
|
||||
run dolt sql -q "show tables" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 3 ]
|
||||
[[ "$output" =~ "Table" ]] || false
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
[[ "$output" =~ "t2" ]] || false
|
||||
run dolt log
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "First commit" ]] || false
|
||||
[[ "$output" =~ "Second commit" ]] || false
|
||||
[[ "$output" =~ "create t2" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: pull force" {
|
||||
cd repo1
|
||||
# disable foreign key checks to create merge conflicts
|
||||
dolt sql <<SQL
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
CREATE TABLE colors (
|
||||
id INT NOT NULL,
|
||||
color VARCHAR(32) NOT NULL,
|
||||
|
||||
PRIMARY KEY (id),
|
||||
INDEX color_index(color)
|
||||
);
|
||||
CREATE TABLE objects (
|
||||
id INT NOT NULL,
|
||||
name VARCHAR(64) NOT NULL,
|
||||
color VARCHAR(32)
|
||||
);
|
||||
SQL
|
||||
dolt commit -A -m "Commit1"
|
||||
dolt push origin main
|
||||
|
||||
cd ../repo2
|
||||
dolt pull
|
||||
dolt sql -q "alter table objects add constraint color FOREIGN KEY (color) REFERENCES colors(color)"
|
||||
dolt commit -A -m "Commit2"
|
||||
|
||||
cd ../repo1
|
||||
dolt sql -q "INSERT INTO objects (id,name,color) VALUES (1,'truck','red'),(2,'ball','green'),(3,'shoe','blue')"
|
||||
dolt commit -A -m "Commit3"
|
||||
dolt push origin main
|
||||
|
||||
cd ../repo2
|
||||
run dolt pull
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONSTRAINT VIOLATION" ]] || false
|
||||
|
||||
dolt merge --abort
|
||||
run dolt pull --force
|
||||
[ "$status" -eq 0 ]
|
||||
run dolt sql -q "select * from objects"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "truck" ]] || false
|
||||
[[ "$output" =~ "ball" ]] || false
|
||||
[[ "$output" =~ "shoe" ]] || false
|
||||
run dolt log
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "First commit" ]] || false
|
||||
[[ "$output" =~ "Second commit" ]] || false
|
||||
[[ "$output" =~ "Commit1" ]] || false
|
||||
[[ "$output" =~ "Commit3" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: pull squash" {
|
||||
cd repo2
|
||||
dolt sql -q "create table t2 (i int primary key);"
|
||||
dolt commit -Am "commit 1"
|
||||
|
||||
dolt pull --squash origin
|
||||
run dolt sql -q "show tables" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 3 ]
|
||||
[[ "$output" =~ "Table" ]] || false
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
[[ "$output" =~ "t2" ]] || false
|
||||
|
||||
run dolt log
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Merge branch" ]] || false
|
||||
[[ ! "$output" =~ "Second commit" ]] || false
|
||||
[[ ! "$output" =~ "First commit" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: pull --noff flag" {
|
||||
cd repo2
|
||||
dolt pull --no-ff origin
|
||||
dolt status
|
||||
|
||||
run dolt log -n 1
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Merge branch 'main'" ]] || false
|
||||
|
||||
run dolt sql -q "show tables" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
[[ "$output" =~ "Table" ]] || false
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: pull dirty working set fails" {
|
||||
cd repo2
|
||||
dolt pull
|
||||
|
||||
cd ../repo1
|
||||
dolt sql -q "insert into t1 values (3, 3)"
|
||||
dolt commit -am "dirty commit"
|
||||
dolt push origin main
|
||||
|
||||
cd ../repo2
|
||||
dolt sql -q "insert into t1 values (2, 2)"
|
||||
run dolt pull origin
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "cannot merge with uncommitted changes" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: pull tag" {
|
||||
cd repo1
|
||||
dolt tag v1
|
||||
dolt push origin v1
|
||||
dolt tag
|
||||
|
||||
cd ../repo2
|
||||
dolt pull origin
|
||||
run dolt tag
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "v1" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: pull tags only for resolved commits" {
|
||||
cd repo1
|
||||
dolt tag v1 head
|
||||
dolt tag v2 head^
|
||||
dolt push origin v1
|
||||
dolt push origin v2
|
||||
|
||||
dolt checkout feature
|
||||
dolt sql -q "create table t2 (a int)"
|
||||
dolt add .
|
||||
dolt commit -am "feature commit"
|
||||
dolt tag v3
|
||||
dolt push origin v3
|
||||
|
||||
cd ../repo2
|
||||
dolt pull origin
|
||||
run dolt tag
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "v1" ]] || false
|
||||
[[ "$output" =~ "v2" ]] || false
|
||||
[[ ! "$output" =~ "v3" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: pull with remote and remote ref" {
|
||||
cd repo1
|
||||
dolt checkout feature
|
||||
dolt checkout -b newbranch
|
||||
run dolt sql -q "show tables"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ ! "$output" =~ "t1" ]] || false
|
||||
|
||||
# Specifying a non-existent remote branch returns an error
|
||||
run dolt pull origin doesnotexist
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ 'branch "doesnotexist" not found on remote' ]] || false
|
||||
|
||||
# Explicitly specifying the remote and branch will merge in that branch
|
||||
run dolt pull origin main
|
||||
[ "$status" -eq 0 ]
|
||||
run dolt sql -q "show tables"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
run dolt status
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "working tree clean" ]] || false
|
||||
|
||||
# Make a conflicting working set change and test that pull complains
|
||||
dolt reset --hard HEAD^1
|
||||
dolt sql -q "insert into t1 values (0, 100);"
|
||||
run dolt pull origin main
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ 'cannot merge with uncommitted changes' ]] || false
|
||||
|
||||
# Commit changes and test that a merge conflict fails the pull
|
||||
dolt commit -am "adding new t1 table"
|
||||
run dolt pull origin main
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "Auto-merging t1" ]] || false
|
||||
[[ "$output" =~ "CONFLICT (content): Merge conflict in t1" ]] || false
|
||||
[[ "$output" =~ "Automatic merge failed; 1 table(s) are unmerged." ]] || false
|
||||
[[ "$output" =~ "Use 'dolt conflicts' to investigate and resolve conflicts." ]] || false
|
||||
|
||||
run dolt show head
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "adding new t1 table" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: pull also fetches, but does not merge other branches" {
|
||||
cd repo1
|
||||
dolt checkout -b other
|
||||
dolt push --set-upstream origin other
|
||||
dolt checkout feature
|
||||
dolt push origin feature
|
||||
|
||||
cd ../repo2
|
||||
dolt fetch
|
||||
# this checkout will set upstream because 'other' branch is a new branch that matches one of remote tracking branch
|
||||
dolt checkout other
|
||||
# this checkout will not set upstream because this 'feature' branch existed before matching remote tracking branch was created
|
||||
dolt checkout feature
|
||||
dolt push --set-upstream origin feature
|
||||
|
||||
cd ../repo1
|
||||
dolt merge main
|
||||
dolt push origin feature
|
||||
dolt checkout other
|
||||
dolt commit --allow-empty -m "new commit on other"
|
||||
dolt push
|
||||
|
||||
cd ../repo2
|
||||
dolt pull
|
||||
run dolt sql -q "show tables" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
[[ "$output" =~ "Table" ]] || false
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
|
||||
dolt checkout other
|
||||
run dolt log --oneline -n 1
|
||||
[ "$status" -eq 0 ]
|
||||
[[ ! "$output" =~ "new commit on other" ]] || false
|
||||
|
||||
run dolt status
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "behind 'origin/other' by 1 commit" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: pull commits successful merge on current branch" {
|
||||
cd repo1
|
||||
dolt checkout -b other
|
||||
dolt push --set-upstream origin other
|
||||
|
||||
cd ../repo2
|
||||
dolt fetch
|
||||
# this checkout will set upstream because 'other' branch is a new branch that matches one of remote tracking branch
|
||||
dolt checkout other
|
||||
|
||||
cd ../repo1
|
||||
dolt sql -q "insert into t1 values (1, 2)"
|
||||
dolt commit -am "add (1,2) to t1"
|
||||
dolt push
|
||||
|
||||
cd ../repo2
|
||||
run dolt sql -q "select * from t1" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[[ ! "$output" =~ "1,2" ]] || false
|
||||
|
||||
dolt sql -q "insert into t1 values (2, 3)"
|
||||
dolt commit -am "add (2,3) to t1"
|
||||
run dolt pull
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run dolt log --oneline -n 1
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Merge branch 'other' of" ]] || false
|
||||
[[ ! "$output" =~ "add (1,2) to t1" ]] || false
|
||||
[[ ! "$output" =~ "add (2,3) to t1" ]] || false
|
||||
}
|
||||
|
||||
@test "pull: --no-ff and --no-commit" {
|
||||
cd repo2
|
||||
run dolt sql -q "show tables" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 1 ]
|
||||
|
||||
run dolt pull --no-ff --no-commit origin
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Automatic merge went well; stopped before committing as requested" ]] || false
|
||||
|
||||
run dolt sql -q "show tables" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
|
||||
dolt commit -m "merge from origin"
|
||||
run dolt log
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "merge from origin" ]] || false
|
||||
}
|
||||
@@ -4,36 +4,35 @@ load $BATS_TEST_DIRNAME/helper/common.bash
|
||||
setup() {
|
||||
setup_common
|
||||
|
||||
TMPDIRS=$(pwd)/tmpdirs
|
||||
mkdir -p $TMPDIRS/{rem1,repo1}
|
||||
TESTDIRS=$(pwd)/testdirs
|
||||
mkdir -p $TESTDIRS/{rem1,repo1}
|
||||
|
||||
# repo1 -> rem1 -> repo2
|
||||
cd $TMPDIRS/repo1
|
||||
cd $TESTDIRS/repo1
|
||||
dolt init
|
||||
dolt remote add origin file://../rem1
|
||||
dolt remote add test-remote file://../rem1
|
||||
dolt push origin main
|
||||
|
||||
cd $TMPDIRS
|
||||
cd $TESTDIRS
|
||||
dolt clone file://rem1 repo2
|
||||
cd $TMPDIRS/repo2
|
||||
cd $TESTDIRS/repo2
|
||||
dolt log
|
||||
dolt remote add test-remote file://../rem1
|
||||
|
||||
# table and comits only present on repo1, rem1 at start
|
||||
cd $TMPDIRS/repo1
|
||||
cd $TESTDIRS/repo1
|
||||
dolt sql -q "create table t1 (a int primary key, b int)"
|
||||
dolt add .
|
||||
dolt commit -am "First commit"
|
||||
dolt sql -q "insert into t1 values (0,0)"
|
||||
dolt commit -am "Second commit"
|
||||
cd $TMPDIRS
|
||||
cd $TESTDIRS
|
||||
}
|
||||
|
||||
teardown() {
|
||||
teardown_common
|
||||
rm -rf $TMPDIRS
|
||||
cd $BATS_TMPDIR
|
||||
rm -rf $TESTDIRS
|
||||
}
|
||||
|
||||
@test "push: push origin" {
|
||||
|
||||
@@ -109,7 +109,7 @@ teardown() {
|
||||
dolt checkout main
|
||||
dolt merge edit_a -m "merge edit_a"
|
||||
run dolt merge edit_b -m "merge edit_b"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "Merge conflict in dolt_query_catalog" ]] || false
|
||||
|
||||
run dolt conflicts cat .
|
||||
|
||||
@@ -69,7 +69,7 @@ teardown() {
|
||||
dolt clone file://./remote repo2
|
||||
|
||||
cd repo2
|
||||
dolt pull
|
||||
dolt pull
|
||||
|
||||
|
||||
dolt commit --allow-empty -m "a commit for main from repo2"
|
||||
@@ -404,7 +404,7 @@ SQL
|
||||
dolt sql -q "create table t1 (pk int primary key);"
|
||||
run dolt pull test-remote test-branch
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ 'local changes to the following tables would be overwritten by merge' ]] || false
|
||||
[[ "$output" =~ 'cannot merge with uncommitted changes' ]] || false
|
||||
|
||||
# Commit changes and test that a merge conflict fails the pull
|
||||
dolt add .
|
||||
@@ -933,7 +933,7 @@ SQL
|
||||
[[ ! "$output" =~ "test commit" ]] || false
|
||||
run dolt merge origin/main
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Already up to date." ]] || false
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
run dolt fetch
|
||||
[ "$status" -eq 0 ]
|
||||
run dolt merge origin/main
|
||||
@@ -967,7 +967,7 @@ SQL
|
||||
cd "dolt-repo-clones/test-repo"
|
||||
run dolt merge remotes/origin/main
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Already up to date." ]] || false
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
run dolt fetch origin main
|
||||
[ "$status" -eq 0 ]
|
||||
run dolt merge remotes/origin/main
|
||||
@@ -1153,7 +1153,7 @@ SQL
|
||||
dolt add test
|
||||
dolt commit -m "conflicting row"
|
||||
run dolt pull origin
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
dolt conflicts resolve test --ours
|
||||
dolt add test
|
||||
@@ -1234,9 +1234,7 @@ SQL
|
||||
dolt sql -q "insert into test values (0, 1, 1, 1, 1, 1)"
|
||||
run dolt pull origin
|
||||
[ "$status" -ne 0 ]
|
||||
[[ "$output" =~ "error: Your local changes to the following tables would be overwritten by merge:" ]] || false
|
||||
[[ "$output" =~ "test" ]] || false
|
||||
[[ "$output" =~ "Please commit your changes before you merge." ]] || false
|
||||
[[ "$output" =~ "cannot merge with uncommitted changes" ]] || false
|
||||
}
|
||||
|
||||
@test "remotes: force push to main" {
|
||||
@@ -1351,7 +1349,7 @@ SQL
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "remotes: validate that a config isn't needed for a pull." {
|
||||
@test "remotes: validate that a config is needed for a pull." {
|
||||
dolt remote add test-remote http://localhost:50051/test-org/test-repo
|
||||
dolt push test-remote main
|
||||
dolt fetch test-remote
|
||||
@@ -1373,17 +1371,23 @@ SQL
|
||||
cd "dolt-repo-clones/test-repo"
|
||||
dolt config --global --unset user.name
|
||||
dolt config --global --unset user.email
|
||||
|
||||
run dolt pull
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "Could not determine name and/or email." ]] || false
|
||||
|
||||
dolt config --global --add user.name mysql-test-runner
|
||||
dolt config --global --add user.email mysql-test-runner@liquidata.co
|
||||
dolt pull
|
||||
run dolt log
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "test commit" ]] || false
|
||||
|
||||
# test pull with workspace up to date
|
||||
dolt config --global --unset user.name
|
||||
dolt config --global --unset user.email
|
||||
run dolt pull
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date." ]] || false
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "Could not determine name and/or email." ]] || false
|
||||
|
||||
# turn back on the configs and make a change in the remote
|
||||
dolt config --global --add user.name mysql-test-runner
|
||||
@@ -1402,7 +1406,7 @@ SQL
|
||||
|
||||
run dolt pull --no-ff
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "Aborting commit due to empty committer name. Is your config set?" ]] || false
|
||||
[[ "$output" =~ "Could not determine name and/or email." ]] || false
|
||||
|
||||
# Now do a two sided merge
|
||||
dolt config --global --add user.name mysql-test-runner
|
||||
@@ -1422,7 +1426,7 @@ SQL
|
||||
|
||||
run dolt pull
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "Aborting commit due to empty committer name. Is your config set?" ]] || false
|
||||
[[ "$output" =~ "Could not determine name and/or email." ]] || false
|
||||
}
|
||||
|
||||
create_main_remote_branch() {
|
||||
@@ -2047,7 +2051,8 @@ SQL
|
||||
|
||||
run dolt pull
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date." ]] || false
|
||||
echo "$output"
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
}
|
||||
|
||||
@test "remotes: call dolt_checkout track flag sets upstream" {
|
||||
@@ -2085,7 +2090,7 @@ SQL
|
||||
|
||||
run dolt pull
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date." ]] || false
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
}
|
||||
|
||||
@test "remotes: call dolt_checkout with --track and no arg returns error" {
|
||||
@@ -2125,7 +2130,7 @@ SQL
|
||||
|
||||
run dolt pull
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date." ]] || false
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
|
||||
dolt checkout main
|
||||
dolt branch -D newbranch
|
||||
@@ -2138,10 +2143,10 @@ SQL
|
||||
|
||||
run dolt pull
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date." ]] || false
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
}
|
||||
|
||||
@test "remotes: dolt sql -q 'call dolt_checkout("-b", "newbranch", "--track", "origin/feature")'' checks out new local branch 'newbranch' with upstream set" {
|
||||
@test "remotes: call dolt_checkout('-b', 'newbranch', '--track', 'origin/feature') checks out new local branch 'newbranch' with upstream set" {
|
||||
mkdir remote
|
||||
mkdir repo1
|
||||
|
||||
@@ -2167,7 +2172,7 @@ SQL
|
||||
|
||||
run dolt pull
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date." ]] || false
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
|
||||
dolt checkout main
|
||||
dolt branch -D newbranch
|
||||
@@ -2182,7 +2187,7 @@ SQL
|
||||
|
||||
run dolt pull
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date." ]] || false
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
}
|
||||
|
||||
@test "remotes: dolt branch track flag sets upstream" {
|
||||
@@ -2217,7 +2222,7 @@ SQL
|
||||
dolt checkout other
|
||||
run dolt pull
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date." ]] || false
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
|
||||
# NOTE: this command fails with git, requiring `--track=direct`, when both branch name and starting point name are defined, but Dolt allows both formats.
|
||||
run dolt branch feature --track direct origin/other
|
||||
@@ -2281,7 +2286,7 @@ SQL
|
||||
|
||||
run dolt pull
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date." ]] || false
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
|
||||
# NOTE: this command fails with git, requiring `--track=direct`, when both branch name and starting point name are defined, but Dolt allows both formats.
|
||||
dolt sql -q "CALL DOLT_BRANCH('feature','--track','direct','origin/other');"
|
||||
|
||||
@@ -42,7 +42,9 @@ setup_schema_conflict() {
|
||||
@test "schema-conflicts: cli merge, query schema conflicts" {
|
||||
setup_schema_conflict
|
||||
|
||||
dolt merge other
|
||||
run dolt merge other
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (schema)" ]] || false
|
||||
|
||||
run dolt sql -q "select our_schema from dolt_schema_conflicts" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -89,7 +89,7 @@ teardown() {
|
||||
[[ $output =~ "main" ]] || false
|
||||
|
||||
run dolt merge other
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "Automatic merge failed" ]] || false
|
||||
|
||||
run dolt sql -q "CALL dolt_conflicts_resolve('--ours', 't')"
|
||||
@@ -108,7 +108,7 @@ teardown() {
|
||||
[[ $output =~ "main" ]] || false
|
||||
|
||||
run dolt merge other
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "Automatic merge failed" ]] || false
|
||||
|
||||
run dolt sql -q "CALL dolt_conflicts_resolve('--theirs', 't')"
|
||||
@@ -127,7 +127,7 @@ teardown() {
|
||||
[[ $output =~ "other" ]] || false
|
||||
|
||||
run dolt merge main
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "Automatic merge failed" ]] || false
|
||||
|
||||
run dolt sql -q "CALL dolt_conflicts_resolve('--ours', 't')"
|
||||
@@ -146,7 +146,7 @@ teardown() {
|
||||
[[ $output =~ "other" ]] || false
|
||||
|
||||
run dolt merge main
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "Automatic merge failed" ]] || false
|
||||
|
||||
run dolt sql -q "CALL dolt_conflicts_resolve('--theirs', 't')"
|
||||
|
||||
@@ -46,7 +46,9 @@ teardown() {
|
||||
dolt add .
|
||||
dolt commit -m "changed feature_branch"
|
||||
dolt checkout main
|
||||
dolt merge feature_branch -m "merge"
|
||||
run dolt merge feature_branch -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content)" ]] || false
|
||||
|
||||
EXPECTED=$( echo -e "table,num_conflicts\none_pk,1\ntwo_pk,1")
|
||||
run dolt sql -r csv -q "SELECT * FROM dolt_conflicts ORDER BY \`table\`"
|
||||
@@ -108,7 +110,9 @@ SQL
|
||||
dolt add .
|
||||
dolt commit -m "changed feature_branch"
|
||||
dolt checkout main
|
||||
dolt merge feature_branch -m "merge"
|
||||
run dolt merge feature_branch -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content)" ]] || false
|
||||
|
||||
EXPECTED=$( echo -e "table,num_conflicts\none_pk,1\ntwo_pk,1")
|
||||
run dolt sql -r csv -q "SELECT * FROM dolt_conflicts ORDER BY \`table\`"
|
||||
@@ -166,7 +170,9 @@ SQL
|
||||
dolt add .
|
||||
dolt commit -m "changed feature_branch"
|
||||
dolt checkout main
|
||||
dolt merge feature_branch -m "merge"
|
||||
run dolt merge feature_branch -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content)" ]] || false
|
||||
|
||||
EXPECTED=$( echo -e "table,num_conflicts\none_pk,1\ntwo_pk,1")
|
||||
run dolt sql -r csv -q "SELECT * FROM dolt_conflicts ORDER BY \`table\`"
|
||||
@@ -229,7 +235,9 @@ SQL
|
||||
dolt add .
|
||||
dolt commit -m "changed feature_branch"
|
||||
dolt checkout main
|
||||
dolt merge feature_branch -m "merge"
|
||||
run dolt merge feature_branch -m "merge"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content)" ]] || false
|
||||
|
||||
EXPECTED=$( echo -e "table,num_conflicts\none_pk,5")
|
||||
run dolt sql -r csv -q "SELECT * FROM dolt_conflicts"
|
||||
|
||||
@@ -3,24 +3,24 @@ load $BATS_TEST_DIRNAME/helper/common.bash
|
||||
|
||||
setup() {
|
||||
setup_common
|
||||
TMPDIRS=$(pwd)/tmpdirs
|
||||
mkdir -p $TMPDIRS/{rem1,repo1}
|
||||
TESTDIRS=$(pwd)/testdirs
|
||||
mkdir -p $TESTDIRS/{rem1,repo1}
|
||||
|
||||
# repo1 -> rem1 -> repo2
|
||||
cd $TMPDIRS/repo1
|
||||
cd $TESTDIRS/repo1
|
||||
dolt init
|
||||
dolt remote add origin file://../rem1
|
||||
dolt remote add test-remote file://../rem1
|
||||
dolt push origin main
|
||||
|
||||
cd $TMPDIRS
|
||||
cd $TESTDIRS
|
||||
dolt clone file://rem1 repo2
|
||||
cd $TMPDIRS/repo2
|
||||
cd $TESTDIRS/repo2
|
||||
dolt branch feature
|
||||
dolt remote add test-remote file://../rem1
|
||||
|
||||
# table and commits only present on repo1, rem1 at start
|
||||
cd $TMPDIRS/repo1
|
||||
cd $TESTDIRS/repo1
|
||||
dolt sql -q "create table t1 (a int primary key, b int)"
|
||||
dolt add .
|
||||
dolt commit -am "First commit"
|
||||
@@ -28,13 +28,12 @@ setup() {
|
||||
dolt commit -am "Second commit"
|
||||
dolt branch feature
|
||||
dolt push origin main
|
||||
cd $TMPDIRS
|
||||
cd $TESTDIRS
|
||||
}
|
||||
|
||||
teardown() {
|
||||
teardown_common
|
||||
rm -rf $TMPDIRS
|
||||
cd $BATS_TMPDIR
|
||||
rm -rf $TESTDIRS
|
||||
}
|
||||
|
||||
@test "sql-fetch: dolt_fetch default" {
|
||||
|
||||
@@ -523,7 +523,9 @@ MODIFY COLUMN age BIGINT;
|
||||
SQL
|
||||
dolt commit -am "left"
|
||||
|
||||
dolt merge right -m "merge right"
|
||||
run dolt merge right -m "merge right"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (schema)" ]] || false
|
||||
|
||||
run dolt conflicts cat .
|
||||
[ "$status" -eq 0 ]
|
||||
@@ -739,7 +741,7 @@ SQL
|
||||
[ $status -eq 0 ]
|
||||
[[ $output =~ "main" ]] || false
|
||||
run dolt merge other
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "Automatic merge failed" ]] || false
|
||||
|
||||
# start server
|
||||
@@ -768,7 +770,7 @@ SQL
|
||||
[[ $output =~ "main" ]] || false
|
||||
|
||||
run dolt merge other
|
||||
[ $status -eq 0 ]
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "Automatic merge failed" ]] || false
|
||||
|
||||
run dolt conflicts resolve --ours .
|
||||
@@ -1182,3 +1184,34 @@ SQL
|
||||
[ $status -eq 0 ]
|
||||
[[ "$output" =~ "cm2" ]] || false
|
||||
}
|
||||
|
||||
@test "sql-local-remote: verify dolt pull behavior" {
|
||||
mkdir remote
|
||||
cd altDB
|
||||
dolt remote add origin file://../remote
|
||||
dolt commit --allow-empty -m "cm1"
|
||||
dolt push origin main
|
||||
|
||||
cd ..
|
||||
dolt clone file://./remote repo
|
||||
cd altDB
|
||||
dolt commit --allow-empty -m "cm2"
|
||||
dolt push origin main
|
||||
|
||||
cd ../repo
|
||||
dolt pull
|
||||
run dolt log
|
||||
[ $status -eq 0 ]
|
||||
[[ "$output" =~ "cm2" ]] || false
|
||||
|
||||
cd ../altDB
|
||||
dolt commit --allow-empty -m "cm3"
|
||||
dolt push origin main
|
||||
cd ../repo
|
||||
|
||||
start_sql_server repo
|
||||
dolt pull origin main
|
||||
run dolt log
|
||||
[ $status -eq 0 ]
|
||||
[[ "$output" =~ "cm3" ]] || false
|
||||
}
|
||||
|
||||
@@ -4,39 +4,38 @@ load $BATS_TEST_DIRNAME/helper/common.bash
|
||||
setup() {
|
||||
setup_common
|
||||
|
||||
TMPDIRS=$(pwd)/tmpdirs
|
||||
mkdir -p $TMPDIRS/{rem1,repo1}
|
||||
TESTDIRS=$(pwd)/testdirs
|
||||
mkdir -p $TESTDIRS/{rem1,repo1}
|
||||
|
||||
# repo1 -> rem1 -> repo2
|
||||
cd $TMPDIRS/repo1
|
||||
cd $TESTDIRS/repo1
|
||||
dolt init
|
||||
dolt branch feature
|
||||
dolt remote add origin file://../rem1
|
||||
dolt remote add test-remote file://../rem1
|
||||
dolt push origin main
|
||||
|
||||
cd $TMPDIRS
|
||||
cd $TESTDIRS
|
||||
dolt clone file://rem1 repo2
|
||||
cd $TMPDIRS/repo2
|
||||
cd $TESTDIRS/repo2
|
||||
dolt log
|
||||
dolt branch feature
|
||||
dolt remote add test-remote file://../rem1
|
||||
|
||||
# table and commits only present on repo1, rem1 at start
|
||||
cd $TMPDIRS/repo1
|
||||
cd $TESTDIRS/repo1
|
||||
dolt sql -q "create table t1 (a int primary key, b int)"
|
||||
dolt add .
|
||||
dolt commit -am "First commit"
|
||||
dolt sql -q "insert into t1 values (0,0)"
|
||||
dolt commit -am "Second commit"
|
||||
dolt push origin main
|
||||
cd $TMPDIRS
|
||||
cd $TESTDIRS
|
||||
}
|
||||
|
||||
teardown() {
|
||||
teardown_common
|
||||
rm -rf $TMPDIRS
|
||||
cd $BATS_TMPDIR
|
||||
rm -rf $TESTDIRS
|
||||
}
|
||||
|
||||
@test "sql-pull: dolt_pull main" {
|
||||
@@ -160,44 +159,68 @@ teardown() {
|
||||
}
|
||||
|
||||
@test "sql-pull: dolt_pull force" {
|
||||
skip "todo: support dolt pull --force (cli too)"
|
||||
cd repo2
|
||||
dolt sql -q "create table t2 (a int)"
|
||||
dolt commit -am "2.0 commit"
|
||||
cd repo1
|
||||
# disable foreign key checks to create merge conflicts
|
||||
dolt sql <<SQL
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
CREATE TABLE colors (
|
||||
id INT NOT NULL,
|
||||
color VARCHAR(32) NOT NULL,
|
||||
|
||||
PRIMARY KEY (id),
|
||||
INDEX color_index(color)
|
||||
);
|
||||
CREATE TABLE objects (
|
||||
id INT NOT NULL,
|
||||
name VARCHAR(64) NOT NULL,
|
||||
color VARCHAR(32)
|
||||
);
|
||||
SQL
|
||||
dolt commit -A -m "Commit1"
|
||||
dolt push origin main
|
||||
|
||||
cd ../repo2
|
||||
dolt pull
|
||||
dolt sql -q "alter table objects add constraint color FOREIGN KEY (color) REFERENCES colors(color)"
|
||||
dolt commit -A -m "Commit2"
|
||||
|
||||
cd ../repo1
|
||||
dolt sql -q "create table t2 (a int primary key)"
|
||||
dolt sql -q "create table t3 (a int primary key)"
|
||||
dolt commit -am "2.1 commit"
|
||||
dolt push -f origin main
|
||||
dolt sql -q "INSERT INTO objects (id,name,color) VALUES (1,'truck','red'),(2,'ball','green'),(3,'shoe','blue')"
|
||||
dolt commit -A -m "Commit3"
|
||||
dolt push origin main
|
||||
|
||||
cd ../repo2
|
||||
run dolt sql -q "CALL dolt_pull('origin')"
|
||||
run dolt sql -q "call dolt_pull()"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ ! "$output" =~ "panic" ]] || false
|
||||
[[ "$output" =~ "fetch failed; dataset head is not ancestor of commit" ]] || false
|
||||
[[ "$output" =~ "Constraint violations" ]] || false
|
||||
|
||||
dolt sql -q "CALL dolt_pull('-f', 'origin')"
|
||||
|
||||
run dolt log -n 1
|
||||
run dolt sql -q "call dolt_pull('--force')"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "2.1 commit" ]] || false
|
||||
|
||||
run dolt sql -q "show tables" -r csv
|
||||
[ "${#lines[@]}" -eq 4 ]
|
||||
[[ "$output" =~ "t3" ]] || false
|
||||
run dolt sql -q "select * from objects"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "truck" ]] || false
|
||||
[[ "$output" =~ "ball" ]] || false
|
||||
[[ "$output" =~ "shoe" ]] || false
|
||||
}
|
||||
|
||||
@test "sql-pull: CALL dolt_pull squash" {
|
||||
skip "todo: support dolt pull --squash (cli too)"
|
||||
cd repo2
|
||||
dolt sql -q "create table t2 (i int primary key);"
|
||||
dolt commit -Am "commit 1"
|
||||
|
||||
dolt sql -q "CALL dolt_pull('--squash', 'origin')"
|
||||
run dolt sql -q "show tables" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
[ "${#lines[@]}" -eq 3 ]
|
||||
[[ "$output" =~ "Table" ]] || false
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
[[ "$output" =~ "t2" ]] || false
|
||||
|
||||
run dolt log
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Merge branch" ]] || false
|
||||
[[ ! "$output" =~ "Second commit" ]] || false
|
||||
[[ ! "$output" =~ "First commit" ]] || false
|
||||
}
|
||||
|
||||
@test "sql-pull: dolt_pull --noff flag" {
|
||||
@@ -423,3 +446,22 @@ teardown() {
|
||||
[[ ! "$output" =~ "add (1,2) to t1" ]] || false
|
||||
[[ ! "$output" =~ "add (2,3) to t1" ]] || false
|
||||
}
|
||||
|
||||
@test "sql-pull: --no-ff and --no-commit" {
|
||||
cd repo2
|
||||
run dolt sql -q "show tables" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 1 ]
|
||||
|
||||
dolt sql -q "call dolt_pull('--no-ff', '--no-commit')"
|
||||
run dolt sql -q "show tables" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
|
||||
dolt commit -m "merge from origin"
|
||||
run dolt log
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "merge from origin" ]] || false
|
||||
}
|
||||
|
||||
|
||||
@@ -4,36 +4,35 @@ load $BATS_TEST_DIRNAME/helper/common.bash
|
||||
setup() {
|
||||
setup_common
|
||||
|
||||
TMPDIRS=$(pwd)/tmpdirs
|
||||
mkdir -p $TMPDIRS/{rem1,repo1}
|
||||
TESTDIRS=$(pwd)/testdirs
|
||||
mkdir -p $TESTDIRS/{rem1,repo1}
|
||||
|
||||
# repo1 -> rem1 -> repo2
|
||||
cd $TMPDIRS/repo1
|
||||
cd $TESTDIRS/repo1
|
||||
dolt init
|
||||
dolt remote add origin file://../rem1
|
||||
dolt remote add test-remote file://../rem1
|
||||
dolt push origin main
|
||||
|
||||
cd $TMPDIRS
|
||||
cd $TESTDIRS
|
||||
dolt clone file://rem1 repo2
|
||||
cd $TMPDIRS/repo2
|
||||
cd $TESTDIRS/repo2
|
||||
dolt log
|
||||
dolt remote add test-remote file://../rem1
|
||||
|
||||
# table and comits only present on repo1, rem1 at start
|
||||
cd $TMPDIRS/repo1
|
||||
cd $TESTDIRS/repo1
|
||||
dolt sql -q "create table t1 (a int primary key, b int)"
|
||||
dolt add .
|
||||
dolt commit -am "First commit"
|
||||
dolt sql -q "insert into t1 values (0,0)"
|
||||
dolt commit -am "Second commit"
|
||||
cd $TMPDIRS
|
||||
cd $TESTDIRS
|
||||
}
|
||||
|
||||
teardown() {
|
||||
teardown_common
|
||||
rm -rf $TMPDIRS
|
||||
cd $BATS_TMPDIR
|
||||
rm -rf $TESTDIRS
|
||||
}
|
||||
|
||||
@test "sql-push: dolt_push origin" {
|
||||
|
||||
@@ -99,7 +99,7 @@ teardown() {
|
||||
dolt commit -m "changed pk=0 all cells to 11"
|
||||
dolt checkout main
|
||||
run dolt merge change-cell -m "merge change-cell"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT" ]] || false
|
||||
|
||||
run dolt sql -r csv -q "select * from dolt_status"
|
||||
@@ -143,7 +143,7 @@ teardown() {
|
||||
# A merge with conflicts does not change the working root.
|
||||
# If the conflicts are resolved with --ours, the working root and the docs on the filesystem remain the same.
|
||||
run dolt merge test-b -m "merge test-b"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ $output =~ "CONFLICT" ]] || false
|
||||
|
||||
dolt status
|
||||
|
||||
@@ -108,7 +108,7 @@ SQL
|
||||
dolt sql -q "INSERT INTO t VALUES (2,2);"
|
||||
dolt add -A && dolt commit -m "added values on branch main"
|
||||
run dolt merge other
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "CONFLICT (content): Merge conflict in t" ]] || false
|
||||
run dolt status
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
@@ -193,16 +193,10 @@ EOF
|
||||
}
|
||||
|
||||
@test "dolt merge other into $DEFAULT_BRANCH" {
|
||||
run dolt version
|
||||
if [[ $output =~ "__DOLT__" ]]; then
|
||||
run dolt merge other
|
||||
[ $status -eq 0 ]
|
||||
[[ $output =~ "Merge conflict in abc" ]] || false
|
||||
[[ $output =~ "Automatic merge failed" ]] || false
|
||||
else
|
||||
# throws a conflict
|
||||
dolt merge other
|
||||
fi
|
||||
run dolt merge other
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "Merge conflict in abc" ]] || false
|
||||
[[ $output =~ "Automatic merge failed" ]] || false
|
||||
}
|
||||
|
||||
@test "dolt table import" {
|
||||
@@ -212,4 +206,3 @@ EOF
|
||||
|
||||
dolt sql -q 'drop table abc2'
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user