feat(dolt): add GetChangesSinceExport and CommitExists methods (bd-ejv83)

Add versioned storage methods for incremental export support:
- GetChangesSinceExport: returns changes since a commit hash, with
  NeedsFullExport flag for invalid/GC'd commits
- CommitExists: checks if a commit hash exists, supports short prefixes

Also fixes dolt_diff syntax for embedded driver (from_ref, to_ref, table).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
beads/crew/lizzy
2026-01-20 20:47:33 -08:00
committed by Steve Yegge
parent 6190dd9362
commit 938a17cda5
3 changed files with 407 additions and 4 deletions

View File

@@ -216,7 +216,8 @@ func (s *DoltStore) GetIssueDiff(ctx context.Context, issueID, fromRef, toRef st
return nil, fmt.Errorf("invalid toRef: %w", err)
}
// nolint:gosec // G201: refs are validated by validateRef() above - dolt_diff_issues requires literal
// nolint:gosec // G201: refs are validated by validateRef() above
// Syntax: dolt_diff(from_ref, to_ref, 'table_name')
query := fmt.Sprintf(`
SELECT
from_id, to_id,
@@ -224,7 +225,7 @@ func (s *DoltStore) GetIssueDiff(ctx context.Context, issueID, fromRef, toRef st
from_status, to_status,
from_description, to_description,
diff_type
FROM dolt_diff_issues('%s', '%s')
FROM dolt_diff('%s', '%s', 'issues')
WHERE from_id = ? OR to_id = ?
`, fromRef, toRef)