MCPcopy Create free account
hub / github.com/driangle/taskmd / applyReassignments

Function applyReassignments

apps/cli/internal/cli/deduplicate.go:364–378  ·  view source on GitHub ↗

applyReassignments performs the actual file modifications. refOverrides maps refOverrideKey → target ID for references that the user explicitly chose.

(reassignments []reassignment, allTasks []*model.Task, refOverrides map[string]string)

Source from the content-addressed store, hash-verified

362// applyReassignments performs the actual file modifications.
363// refOverrides maps refOverrideKey → target ID for references that the user explicitly chose.
364func applyReassignments(reassignments []reassignment, allTasks []*model.Task, refOverrides map[string]string) error {
365 for _, r := range reassignments {
366 if err := taskfile.ReplaceID(r.OldFilePath, r.NewID); err != nil {
367 return fmt.Errorf("failed to update ID in %s: %w", r.OldFilePath, err)
368 }
369
370 if r.OldFilePath != r.NewFilePath {
371 if err := os.Rename(r.OldFilePath, r.NewFilePath); err != nil {
372 return fmt.Errorf("failed to rename %s → %s: %w", r.OldFilePath, r.NewFilePath, err)
373 }
374 }
375 }
376
377 return updateCrossReferences(reassignments, allTasks, refOverrides)
378}
379
380// updateCrossReferences rewrites dependency and parent references in all task files.
381func updateCrossReferences(reassignments []reassignment, allTasks []*model.Task, refOverrides map[string]string) error {

Callers 1

runDeduplicateFunction · 0.85

Calls 1

updateCrossReferencesFunction · 0.85

Tested by

no test coverage detected