|  | 
| 1 |  | -(migration)= | 
|  | 1 | +# VCSPull Configuration Migration Guide | 
|  | 2 | + | 
|  | 3 | +VCSPull has updated its configuration format to provide a cleaner, more maintainable, and better validated structure. This guide will help you migrate your existing configuration files to the new format. | 
|  | 4 | + | 
|  | 5 | +## Configuration Format Changes | 
|  | 6 | + | 
|  | 7 | +### Old Format (v1) | 
|  | 8 | + | 
|  | 9 | +The old configuration format used a nested directory structure where paths were mapped to repository groups: | 
|  | 10 | + | 
|  | 11 | +```yaml | 
|  | 12 | +# Old format (v1) | 
|  | 13 | +/home/user/projects: | 
|  | 14 | +  repo1: git+https://github.com/user/repo1.git | 
|  | 15 | +  repo2: | 
|  | 16 | +    url: git+https://github.com/user/repo2.git | 
|  | 17 | +    remotes: | 
|  | 18 | +      upstream: git+https://github.com/upstream/repo2.git | 
|  | 19 | + | 
|  | 20 | +/home/user/work: | 
|  | 21 | +  work-repo:  | 
|  | 22 | +    url: git+https://github.com/company/work-repo.git | 
|  | 23 | +    rev: main | 
|  | 24 | +``` | 
|  | 25 | +
 | 
|  | 26 | +### New Format (v2) | 
|  | 27 | +
 | 
|  | 28 | +The new format is flatter and more structured, with explicit sections for settings, repositories, and includes: | 
|  | 29 | +
 | 
|  | 30 | +```yaml | 
|  | 31 | +# New format (v2) | 
|  | 32 | +settings: | 
|  | 33 | +  sync_remotes: true | 
|  | 34 | +  default_vcs: git | 
|  | 35 | +  depth: null | 
|  | 36 | + | 
|  | 37 | +repositories: | 
|  | 38 | +  - name: repo1 | 
|  | 39 | +    path: /home/user/projects/repo1 | 
|  | 40 | +    url: https://github.com/user/repo1.git | 
|  | 41 | +    vcs: git | 
|  | 42 | +   | 
|  | 43 | +  - name: repo2 | 
|  | 44 | +    path: /home/user/projects/repo2 | 
|  | 45 | +    url: https://github.com/user/repo2.git | 
|  | 46 | +    vcs: git | 
|  | 47 | +    remotes: | 
|  | 48 | +      upstream: https://github.com/upstream/repo2.git | 
|  | 49 | +   | 
|  | 50 | +  - name: work-repo | 
|  | 51 | +    path: /home/user/work/work-repo | 
|  | 52 | +    url: https://github.com/company/work-repo.git | 
|  | 53 | +    vcs: git | 
|  | 54 | +    rev: main | 
|  | 55 | + | 
|  | 56 | +includes: | 
|  | 57 | +  - ~/other-config.yaml | 
|  | 58 | +``` | 
|  | 59 | +
 | 
|  | 60 | +## Migration Tool | 
|  | 61 | +
 | 
|  | 62 | +VCSPull includes a built-in migration tool to help you convert your configuration files to the new format. | 
|  | 63 | +
 | 
|  | 64 | +### Using the Migration Command | 
|  | 65 | +
 | 
|  | 66 | +The migration command is available as a subcommand of vcspull: | 
|  | 67 | +
 | 
|  | 68 | +```bash | 
|  | 69 | +vcspull migrate [OPTIONS] [CONFIG_PATHS...] | 
|  | 70 | +``` | 
|  | 71 | + | 
|  | 72 | +If you don't specify any configuration paths, the tool will search for configuration files in the standard locations: | 
|  | 73 | +- `~/.config/vcspull/` | 
|  | 74 | +- `~/.vcspull/` | 
|  | 75 | +- Current working directory | 
|  | 76 | + | 
|  | 77 | +### Options | 
|  | 78 | + | 
|  | 79 | +| Option | Description | | 
|  | 80 | +|--------|-------------| | 
|  | 81 | +| `-o, --output PATH` | Path to save the migrated configuration (if not specified, overwrites the original) | | 
|  | 82 | +| `-n, --no-backup` | Don't create backup files of original configurations | | 
|  | 83 | +| `-f, --force` | Force migration even if files are already in the latest format | | 
|  | 84 | +| `-d, --dry-run` | Show what would be migrated without making changes | | 
|  | 85 | +| `-c, --color` | Colorize output | | 
|  | 86 | + | 
|  | 87 | +### Examples | 
|  | 88 | + | 
|  | 89 | +#### Migrate a specific configuration file | 
|  | 90 | + | 
|  | 91 | +```bash | 
|  | 92 | +vcspull migrate ~/.vcspull/config.yaml | 
|  | 93 | +``` | 
|  | 94 | + | 
|  | 95 | +#### Preview migrations without making changes | 
|  | 96 | + | 
|  | 97 | +```bash | 
|  | 98 | +vcspull migrate -d -c | 
|  | 99 | +``` | 
|  | 100 | + | 
|  | 101 | +#### Migrate to a new file without overwriting the original | 
|  | 102 | + | 
|  | 103 | +```bash | 
|  | 104 | +vcspull migrate ~/.vcspull/config.yaml -o ~/.vcspull/new-config.yaml | 
|  | 105 | +``` | 
|  | 106 | + | 
|  | 107 | +#### Force re-migration of already migrated configurations | 
|  | 108 | + | 
|  | 109 | +```bash | 
|  | 110 | +vcspull migrate -f | 
|  | 111 | +``` | 
|  | 112 | + | 
|  | 113 | +## Migration Process | 
|  | 114 | + | 
|  | 115 | +When you run the migration command, the following steps occur: | 
|  | 116 | + | 
|  | 117 | +1. The tool detects the version of each configuration file | 
|  | 118 | +2. For each file in the old format (v1): | 
|  | 119 | +   - The paths and repository names are converted to explicit path entries | 
|  | 120 | +   - VCS types are extracted from URL prefixes (e.g., `git+https://` becomes `https://` with `vcs: git`) | 
|  | 121 | +   - Remote repositories are normalized | 
|  | 122 | +   - The new configuration is validated | 
|  | 123 | +   - If valid, the new configuration is saved (with backup of the original) | 
|  | 124 | + | 
|  | 125 | +## Manual Migration | 
|  | 126 | + | 
|  | 127 | +If you prefer to migrate your configurations manually, follow these guidelines: | 
|  | 128 | + | 
|  | 129 | +1. Create a new YAML file with the following structure: | 
|  | 130 | +   ```yaml | 
|  | 131 | +   settings: | 
|  | 132 | +     sync_remotes: true  # or other settings as needed | 
|  | 133 | +     default_vcs: git    # default VCS type if not specified | 
|  | 134 | +    | 
|  | 135 | +   repositories: | 
|  | 136 | +     - name: repo-name | 
|  | 137 | +       path: /path/to/repo | 
|  | 138 | +       url: https://github.com/user/repo.git | 
|  | 139 | +       vcs: git  # or hg, svn as appropriate | 
|  | 140 | +   ``` | 
|  | 141 | +
 | 
|  | 142 | +2. For each repository in your old configuration: | 
|  | 143 | +   - Create a new entry in the `repositories` list | 
|  | 144 | +   - Use the parent path + repo name for the `path` field | 
|  | 145 | +   - Extract the VCS type from URL prefixes if present | 
|  | 146 | +   - Copy remotes, revisions, and other settings | 
|  | 147 | + | 
|  | 148 | +3. If you have included configurations, add them to the `includes` list | 
|  | 149 | + | 
|  | 150 | +## Troubleshooting | 
|  | 151 | + | 
|  | 152 | +### Common Migration Issues | 
|  | 153 | + | 
|  | 154 | +1. **Invalid repository configurations**: Repositories that are missing required fields (like URL) will be skipped during migration. Check the log output for warnings about skipped repositories. | 
|  | 155 | + | 
|  | 156 | +2. **Path resolution**: The migration tool resolves relative paths from the original configuration file. If your migrated configuration has incorrect paths, you may need to adjust them manually. | 
|  | 157 | + | 
|  | 158 | +3. **VCS type detection**: The tool infers VCS types from URL prefixes (`git+`, `hg+`, `svn+`) or from URL patterns (e.g., GitHub URLs are assumed to be Git). If the VCS type is not correctly detected, you may need to add it manually. | 
|  | 159 | + | 
|  | 160 | +### Getting Help | 
|  | 161 | + | 
|  | 162 | +If you encounter issues with the migration process, please: | 
|  | 163 | + | 
|  | 164 | +1. Run the migration with verbose logging: | 
|  | 165 | +   ```bash | 
|  | 166 | +   vcspull migrate -d -c | 
|  | 167 | +   ``` | 
|  | 168 | + | 
|  | 169 | +2. Check the output for error messages and warnings | 
|  | 170 | + | 
|  | 171 | +3. If you need to report an issue, include: | 
|  | 172 | +   - Your original configuration (with sensitive information redacted) | 
|  | 173 | +   - The error message or unexpected behavior | 
|  | 174 | +   - The version of vcspull you're using | 
| 2 | 175 | 
 | 
| 3 | 176 | ```{currentmodule} libtmux | 
| 4 | 177 | 
 | 
|  | 
0 commit comments