1
0
Fork 0
mirror of synced 2024-11-17 06:45:33 -05:00

Remove support for YADM_COMPATIBILITY=1 (#242)

This commit is contained in:
Tim Byrne 2020-10-17 17:40:43 -05:00
parent a66d3c148c
commit b19c78b8e2
No known key found for this signature in database
GPG key ID: 14DB4FC2465A4B12
5 changed files with 4 additions and 60 deletions

View file

@ -4,7 +4,6 @@ import pytest
@pytest.mark.parametrize(
'condition', [
'compat',
'previous-message',
'invalid-alts',
'no-invalid-alts',
@ -12,11 +11,8 @@ import pytest
def test_report_invalid_alts(runner, yadm, condition):
"""Use report_invalid_alts"""
compat = ''
previous = ''
alts = 'INVALID_ALT=()'
if condition == 'compat':
compat = 'YADM_COMPATIBILITY=1'
if condition == 'previous-message':
previous = 'LEGACY_WARNING_ISSUED=1'
if condition == 'invalid-alts':
@ -24,7 +20,6 @@ def test_report_invalid_alts(runner, yadm, condition):
script = f"""
YADM_TEST=1 source {yadm}
{compat}
{previous}
{alts}
report_invalid_alts

View file

@ -4,7 +4,7 @@ import pytest
@pytest.mark.parametrize(
'condition',
['basic', 'override', 'xdg_config_home', 'legacy'],
['basic', 'override', 'xdg_config_home'],
)
def test_set_yadm_dir(runner, yadm, condition):
"""Test set_yadm_dir"""
@ -13,8 +13,6 @@ def test_set_yadm_dir(runner, yadm, condition):
setup = 'YADM_DIR=/override'
elif condition == 'xdg_config_home':
setup = 'XDG_CONFIG_HOME=/xdg'
elif condition == 'legacy':
setup = 'YADM_COMPATIBILITY=1'
script = f"""
HOME=/testhome
YADM_TEST=1 source {yadm}
@ -31,5 +29,3 @@ def test_set_yadm_dir(runner, yadm, condition):
assert run.out.rstrip() == '/override'
elif condition == 'xdg_config_home':
assert run.out.rstrip() == '/xdg/yadm'
elif condition == 'legacy':
assert run.out.rstrip() == '/testhome/.yadm'

View file

@ -11,16 +11,13 @@ LEGACY_PATHS = [
]
# used:
# YADM_COMPATIBILITY
# YADM_DIR
# YADM_LEGACY_DIR
# GIT_PROGRAM
@pytest.mark.parametrize('condition', ['compat', 'equal', 'existing_repo'])
@pytest.mark.parametrize('condition', ['equal', 'existing_repo'])
def test_upgrade_errors(tmpdir, runner, yadm, condition):
"""Test upgrade() error conditions"""
compatibility = 'YADM_COMPATIBILITY=1' if condition == 'compat' else ''
home = tmpdir.mkdir('home')
yadm_dir = home.join('.config/yadm')
legacy_dir = home.join('.yadm')
@ -32,7 +29,6 @@ def test_upgrade_errors(tmpdir, runner, yadm, condition):
script = f"""
YADM_TEST=1 source {yadm}
{compatibility}
YADM_DIR="{yadm_dir}"
YADM_REPO="{yadm_dir}/repo.git"
YADM_LEGACY_DIR="{legacy_dir}"
@ -42,8 +38,6 @@ def test_upgrade_errors(tmpdir, runner, yadm, condition):
assert run.failure
assert run.err == ''
assert 'Unable to upgrade' in run.out
if condition == 'compat':
assert 'YADM_COMPATIBILITY' in run.out
if condition == 'equal':
assert 'has been resolved as' in run.out
if condition == 'existing_repo':

22
yadm
View file

@ -539,20 +539,13 @@ function alt() {
local alt_linked
alt_linked=()
if [ "$YADM_COMPATIBILITY" = "1" ]; then
alt_past_linking
else
alt_future_linking
fi
alt_linking
remove_stale_links
report_invalid_alts
}
function report_invalid_alts() {
[ "$YADM_COMPATIBILITY" = "1" ] && return
[ "$LEGACY_WARNING_ISSUED" = "1" ] && return
[ "${#INVALID_ALT[@]}" = "0" ] && return
local path_list
@ -626,7 +619,7 @@ function set_local_alt_values() {
}
function alt_future_linking() {
function alt_linking() {
local alt_scores
local alt_targets
@ -1353,9 +1346,6 @@ function upgrade() {
local repo_updates
repo_updates=0
[ "$YADM_COMPATIBILITY" = "1" ] && \
error_out "Unable to upgrade. YADM_COMPATIBILITY is set to '1'."
[ "$YADM_DIR" = "$YADM_LEGACY_DIR" ] && \
error_out "Unable to upgrade. yadm dir has been resolved as '$YADM_LEGACY_DIR'."
@ -1564,12 +1554,6 @@ function set_yadm_dir() {
# only resolve YADM_DIR if it hasn't been provided already
[ -n "$YADM_DIR" ] && return
# compatibility with major version 1 ignores XDG_CONFIG_HOME
if [ "$YADM_COMPATIBILITY" = "1" ]; then
YADM_DIR="$YADM_LEGACY_DIR"
return
fi
local base_yadm_dir
base_yadm_dir="$XDG_CONFIG_HOME"
if [[ ! "$base_yadm_dir" =~ ^/ ]] ; then
@ -1633,8 +1617,6 @@ function issue_legacy_path_warning() {
* Run "yadm upgrade" to move the yadm data to the new directory. (RECOMMENDED)
* Manually move yadm configurations to the directory listed above.
* Specify your preferred yadm directory with -Y each execution.
* Define an environment variable "YADM_COMPATIBILITY=1" to run in version 1
compatibility mode. (DEPRECATED)
Legacy paths detected:
${path_list}

23
yadm.1
View file

@ -313,29 +313,6 @@ for more information.
.B version
Print the version of yadm.
.SH COMPATIBILITY
Beginning with version 2.0.0, yadm introduced a couple major changes which may
require you to adjust your configurations.
See the
.B upgrade
command for help making those adjustments.
First, yadm now uses the "XDG Base Directory Specification" to find its
configurations. You can read
https://yadm.io/docs/upgrade_from_1
for more information.
Second, the naming conventions for alternate files have been changed.
You can read https://yadm.io/docs/alternates for more information.
If you want to retain the old functionality, you can set an environment variable,
.IR YADM_COMPATIBILITY=1 .
Doing so will automatically use the old yadm directory, and process alternates
the same as the pre-2.0.0 version. This compatibility mode is deprecated, and
will be removed in future versions. This mode exists solely for transitioning
to the new paths and naming of alternates.
.SH OPTIONS
yadm supports a set of universal options that alter the paths it uses. The