From b5482db58149735d2ce7ef5620e38076d6c010fe Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 30 Jan 2017 23:54:55 +0200 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20check=20for=20updates=20tagged?= =?UTF-8?q?=20VCS=20repo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformio/vcsclient.py | 8 ++++++-- tests/commands/test_lib.py | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/platformio/vcsclient.py b/platformio/vcsclient.py index 59710802..4b43e0a5 100644 --- a/platformio/vcsclient.py +++ b/platformio/vcsclient.py @@ -121,7 +121,9 @@ class GitClient(VCSClientBase): for line in output.split("\n"): line = line.strip() if line.startswith("*"): - return line[1:].strip() + branch = line[1:].strip() + if branch != "(no branch)": + return branch return None def get_tags(self): @@ -158,8 +160,10 @@ class GitClient(VCSClientBase): def get_latest_revision(self): if not self.can_be_updated: - return self.get_latest_revision() + return self.get_current_revision() branch = self.get_current_branch() + if not branch: + return self.get_current_revision() result = self.get_cmd_output(["ls-remote"]) for line in result.split("\n"): ref_pos = line.strip().find("refs/heads/" + branch) diff --git a/tests/commands/test_lib.py b/tests/commands/test_lib.py index c956049c..264a62ef 100644 --- a/tests/commands/test_lib.py +++ b/tests/commands/test_lib.py @@ -39,7 +39,7 @@ def test_global_install_registry(clirunner, validate_cliresult, result = clirunner.invoke(cmd_lib, [ "-g", "install", "58", "OneWire", "http://dl.platformio.org/libraries/archives/3/5174.tar.gz", - "ArduinoJson@5.6.7", "ArduinoJson@>5.6" + "ArduinoJson@5.6.7", "ArduinoJson@~5.7.0" ]) validate_cliresult(result) items1 = [d.basename for d in isolated_pio_home.join("lib").listdir()] @@ -106,15 +106,15 @@ def test_global_lib_update_check(clirunner, validate_cliresult, cmd_lib, ["-g", "update", "--only-check", "--json-output"]) validate_cliresult(result) output = json.loads(result.output) - assert set(["PJON", "RadioHead"]) == set([l['name'] for l in output]) + assert set(["ArduinoJson", "RadioHead"]) == set( + [l['name'] for l in output]) def test_global_lib_update(clirunner, validate_cliresult, isolated_pio_home): result = clirunner.invoke(cmd_lib, ["-g", "update"]) validate_cliresult(result) assert "[Up-to-date]" in result.output - assert re.search(r"Updating PJON\s+@ 1fb26fd\s+\[[a-z\d]{7}\]", - result.output) + assert "Uninstalling ArduinoJson @ 5.7.3" in result.output def test_global_lib_uninstall(clirunner, validate_cliresult,