-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement configuration versioning to defend against Braid version skew.
Bump version to 1.1.0 according to the new policy that each configuration version corresponds to a different Braid minor version. Fixes #66. Now that we have the infrastructure: - Report loss of support for full-history mirrors as a breaking change. Fixes #56. - Correctly upgrade revision locks from Braid < 1.0.18. Fixes #65.
- Loading branch information
1 parent
5d7d208
commit 7fc8316
Showing
40 changed files
with
1,953 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Braid configuration version history | ||
|
||
The Braid configuration file (`.braids.json`) contains a configuration version | ||
number that indicates the format of the configuration file and the Braid | ||
features required by the project. You'll be directed to this page if you use a | ||
version of Braid that does not support the project's configuration version; see | ||
[the readme](README.md#braid-version-compatibility) for more information about | ||
the versioning scheme. | ||
|
||
To get a compatible version of Braid: | ||
|
||
1. First check if the project has its own instructions to install and run Braid, | ||
and if so, follow them instead. | ||
2. Look up the Braid versions corresponding to your current configuration | ||
version in the table below. | ||
3. Run `gem query --remote --all --exact braid` to get a list of all existing | ||
versions of Braid, and choose one that is compatible with your configuration | ||
version (you probably want the newest such version); call it `x.y.z`. | ||
4. Run `gem install braid --version x.y.z` to install the chosen version of | ||
Braid. | ||
5. Run Braid as `braid _x.y.z_` (that's the chosen version surrounded by literal | ||
underscores) followed by your desired arguments. | ||
|
||
<table border="border"> | ||
<tr> | ||
<th>Config. version</th> | ||
<th>Braid versions</th> | ||
<th>Changes since previous</th> | ||
</tr> | ||
<tr> | ||
<td>1</td> | ||
<td>1.1.x</td> | ||
<td>(Various)</td> | ||
</tr> | ||
<tr> | ||
<td>"0"</td> | ||
<td colspan="2"> | ||
(Braid versions earlier than 1.1.0 have varying configuration formats and | ||
features and do not have a well-defined compatibility scheme. Braid 1.1.0 and | ||
newer refer to all of these formats as version "0" and are capable of correctly | ||
upgrading most of them. We recommend upgrading to Braid 1.1.0 or newer if you | ||
can.) | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<style> | ||
header, section#downloads, .inner > hr { | ||
display: none; | ||
} | ||
.inner { | ||
padding-top: 35px; /* same as header when it is visible */ | ||
} | ||
th, td { | ||
border: 1px solid #6d6d6d; | ||
padding: 2px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
module Braid | ||
module Commands | ||
class UpgradeConfig < Command | ||
def config_mode | ||
Config::MODE_UPGRADE | ||
end | ||
|
||
def run(options) | ||
# Config loading in MODE_UPGRADE will bail out only if the config | ||
# version is too new. | ||
|
||
if !config.config_existed | ||
puts <<-MSG | ||
Your repository has no Braid configuration file. It will be created with the | ||
current configuration version when you add the first mirror. | ||
MSG | ||
return | ||
elsif config.config_version == Config::CURRENT_CONFIG_VERSION | ||
puts <<-MSG | ||
Your configuration file is already at the current configuration version (#{Config::CURRENT_CONFIG_VERSION}). | ||
MSG | ||
return | ||
end | ||
|
||
puts <<-MSG | ||
Your configuration file will be upgraded from configuration version #{config.config_version} to #{Config::CURRENT_CONFIG_VERSION}. | ||
Other developers on your project will need to use a Braid version compatible | ||
with configuration version #{Config::CURRENT_CONFIG_VERSION}; see | ||
https://cristibalan.github.io/braid/config_versions.html . | ||
MSG | ||
|
||
unless config.breaking_change_descs.empty? | ||
puts <<-MSG | ||
The following breaking changes will occur: | ||
#{config.breaking_change_descs.join('')} | ||
MSG | ||
end | ||
|
||
if options['dry_run'] | ||
puts <<-MSG | ||
Run 'braid upgrade-config#{config.breaking_change_descs.empty? ? '' : ' --allow-breaking-changes'}' to perform the upgrade. | ||
MSG | ||
elsif !config.breaking_change_descs.empty? && !options['allow_breaking_changes'] | ||
raise BraidError, "You must pass --allow-breaking-changes to accept the breaking changes." | ||
else | ||
config.write_db | ||
add_config_file | ||
had_changes = git.commit("Upgrade configuration") | ||
raise InternalError, "upgrade-config had no changes??" unless had_changes | ||
msg "Configuration upgrade complete." | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.