From b19c78b8e2cdb2b2d1e908a8f3ec838c72d8664d Mon Sep 17 00:00:00 2001 From: Tim Byrne Date: Sat, 17 Oct 2020 17:40:43 -0500 Subject: [PATCH] Remove support for YADM_COMPATIBILITY=1 (#242) --- test/test_unit_report_invalid_alts.py | 5 ----- test/test_unit_set_yadm_dir.py | 6 +----- test/test_unit_upgrade.py | 8 +------- yadm | 22 ++-------------------- yadm.1 | 23 ----------------------- 5 files changed, 4 insertions(+), 60 deletions(-) diff --git a/test/test_unit_report_invalid_alts.py b/test/test_unit_report_invalid_alts.py index 7aa93bb..040b11a 100644 --- a/test/test_unit_report_invalid_alts.py +++ b/test/test_unit_report_invalid_alts.py @@ -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 diff --git a/test/test_unit_set_yadm_dir.py b/test/test_unit_set_yadm_dir.py index 65459f8..c7e414c 100644 --- a/test/test_unit_set_yadm_dir.py +++ b/test/test_unit_set_yadm_dir.py @@ -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' diff --git a/test/test_unit_upgrade.py b/test/test_unit_upgrade.py index 73f4cac..7a38cbe 100644 --- a/test/test_unit_upgrade.py +++ b/test/test_unit_upgrade.py @@ -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': diff --git a/yadm b/yadm index f5545a9..d0ab8a3 100755 --- a/yadm +++ b/yadm @@ -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} diff --git a/yadm.1 b/yadm.1 index 5995ede..80156a8 100644 --- a/yadm.1 +++ b/yadm.1 @@ -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