Merge "Clean up duplicate logic in subcmds/sync.py."