beads/internal/storage/remote.go
Harry Miller 73d72ec0fa
feat: add --remote flag to bd dolt push/pull commands (#3211)
Add PushRemote/PullRemote methods to RemoteStore interface, allowing
push/pull to target a specific named remote instead of the default.

Implementation:
- Refactor Push/ForcePush/Pull to delegate to internal pushToRemote/
  pullFromRemote methods with parameterized remote name
- Parameterize credential routing (isGitProtocolRemote,
  shouldUseCLIForCredentials, shouldUseCLIForCloudAuth) to accept
  remote name instead of using s.remote
- Make shouldUseCLIForCloudAuth per-scheme-aware: Azure env vars only
  trigger CLI routing for az:// remotes, not dolthub:// remotes
- Add credentialsForRemote() helper that only returns creds when the
  target remote matches the default remote (prevents sending wrong
  creds to wrong host)
- Add --remote flag to doltPushCmd and doltPullCmd in CLI
- Implement PushRemote/PullRemote on EmbeddedDoltStore

Backwards compatibility:
- Push(ctx)/Pull(ctx)/ForcePush(ctx) signatures unchanged
- No --remote flag = exact same behavior as today
- PushTo/PullFrom for federation peers unchanged

Closes: bd-4v3

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-20 18:02:33 -07:00

19 lines
748 B
Go

package storage
import "context"
// RemoteStore provides remote management and push/pull/fetch operations.
type RemoteStore interface {
AddRemote(ctx context.Context, name, url string) error
RemoveRemote(ctx context.Context, name string) error
HasRemote(ctx context.Context, name string) (bool, error)
ListRemotes(ctx context.Context) ([]RemoteInfo, error)
Push(ctx context.Context) error
Pull(ctx context.Context) error
ForcePush(ctx context.Context) error
PushRemote(ctx context.Context, remote string, force bool) error
PullRemote(ctx context.Context, remote string) error
Fetch(ctx context.Context, peer string) error
PushTo(ctx context.Context, peer string) error
PullFrom(ctx context.Context, peer string) ([]Conflict, error)
}