Fix some bugs

Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
2022-08-04 14:44:58 +02:00
parent f75702439c
commit cb0d8681ae
3 changed files with 20 additions and 4 deletions

View File

@@ -187,9 +187,14 @@ class Detector:
self._tags.remove(tag)
keep_in_mind_commits: list = []
for commit in list(new_tags.values()) + list(new_branches.values()):
if commit not in keep_in_mind_commits:
keep_in_mind_commits.append(commit)
for key, value in new_branches.items():
if not value == self._branches.get(key):
log.debug(f"Keep in mind branch: {key} -> {value}")
keep_in_mind_commits.append(value)
for key, value in new_tags.items():
if not value == self._tags.get(key):
log.debug(f"Keep in mind tag: {key} -> {value}")
keep_in_mind_commits.append(value)
# list commits
executed_count: int = 0

View File

@@ -1,5 +1,7 @@
from typing import Optional
import os
import logging
log = logging.getLogger("rc.lststor")
class DiskStoredList:
@@ -19,14 +21,18 @@ class DiskStoredList:
self._load_from_file()
def _load_from_file(self):
log.debug(f"DiskStoredList: loading")
with open(self.__file, 'r') as f:
for line in f.readlines():
line = line.strip()
if len(line):
self.__items.append(line)
log.debug(f"DiskStoredList: loaded {len(self.__items)}")
def append(self, line: str):
with open(self.__file, 'a') as f:
log.debug(f"DiskStoredList: append {line}")
self.__items.append(line)
f.write(f"{line}\n")
@@ -34,6 +40,7 @@ class DiskStoredList:
return len(self.__items)
def __contains__(self, line: str) -> bool:
log.debug(f"DiskStoredList: contains? {line}")
return line in self.__items
def __iter__(self):