batchfetch 1.0.7__tar.gz → 1.0.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {batchfetch-1.0.7 → batchfetch-1.0.8}/PKG-INFO +1 -1
- {batchfetch-1.0.7 → batchfetch-1.0.8}/batchfetch/batchfetch_cli.py +14 -12
- {batchfetch-1.0.7 → batchfetch-1.0.8}/batchfetch/batchfetch_git.py +26 -18
- {batchfetch-1.0.7 → batchfetch-1.0.8}/batchfetch.egg-info/PKG-INFO +1 -1
- {batchfetch-1.0.7 → batchfetch-1.0.8}/setup.py +1 -1
- {batchfetch-1.0.7 → batchfetch-1.0.8}/LICENSE +0 -0
- {batchfetch-1.0.7 → batchfetch-1.0.8}/README.md +0 -0
- {batchfetch-1.0.7 → batchfetch-1.0.8}/batchfetch/__init__.py +0 -0
- {batchfetch-1.0.7 → batchfetch-1.0.8}/batchfetch/batchfetch_base.py +0 -0
- {batchfetch-1.0.7 → batchfetch-1.0.8}/batchfetch/helpers.py +0 -0
- {batchfetch-1.0.7 → batchfetch-1.0.8}/batchfetch.egg-info/SOURCES.txt +0 -0
- {batchfetch-1.0.7 → batchfetch-1.0.8}/batchfetch.egg-info/dependency_links.txt +0 -0
- {batchfetch-1.0.7 → batchfetch-1.0.8}/batchfetch.egg-info/entry_points.txt +0 -0
- {batchfetch-1.0.7 → batchfetch-1.0.8}/batchfetch.egg-info/requires.txt +0 -0
- {batchfetch-1.0.7 → batchfetch-1.0.8}/batchfetch.egg-info/top_level.txt +0 -0
- {batchfetch-1.0.7 → batchfetch-1.0.8}/setup.cfg +0 -0
|
@@ -43,7 +43,7 @@ class BatchFetchCli:
|
|
|
43
43
|
def __init__(self, max_workers: int, verbose: bool = False):
|
|
44
44
|
self.cfg: dict = {}
|
|
45
45
|
self.folder = Path(".")
|
|
46
|
-
self.
|
|
46
|
+
self.managed_paths: Set[Path] = set()
|
|
47
47
|
self.verbose = verbose
|
|
48
48
|
self.max_workers = max_workers
|
|
49
49
|
self._logger = logging.getLogger(self.__class__.__name__)
|
|
@@ -149,7 +149,7 @@ class BatchFetchCli:
|
|
|
149
149
|
error = False
|
|
150
150
|
threads = []
|
|
151
151
|
num_success = 0
|
|
152
|
-
self.
|
|
152
|
+
self.managed_paths = set()
|
|
153
153
|
|
|
154
154
|
executor_update = ThreadPoolExecutor(max_workers=self.max_workers)
|
|
155
155
|
|
|
@@ -160,26 +160,28 @@ class BatchFetchCli:
|
|
|
160
160
|
for task in all_tasks:
|
|
161
161
|
self.dirs_relative_to_batchfetch.add(str(task["path"]))
|
|
162
162
|
if not task["delete"]:
|
|
163
|
-
self.
|
|
163
|
+
self.managed_paths.add(Path(task["path"]).absolute())
|
|
164
164
|
threads.append(executor_update.submit(task.update))
|
|
165
165
|
|
|
166
166
|
for future in as_completed(threads):
|
|
167
167
|
data = future.result()
|
|
168
168
|
if data["result"]["error"]:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
print(Fore.YELLOW, end="")
|
|
169
|
+
error = True
|
|
170
|
+
failed.append(data)
|
|
172
171
|
else:
|
|
173
|
-
|
|
174
|
-
continue
|
|
172
|
+
num_success += 1
|
|
175
173
|
|
|
176
|
-
|
|
174
|
+
if (not self.verbose and
|
|
175
|
+
not data["result"]["error"] and
|
|
176
|
+
not data["result"]["changed"]):
|
|
177
|
+
continue
|
|
177
178
|
|
|
178
179
|
if data["result"]["error"]:
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
print(Fore.RED, end="")
|
|
181
|
+
elif data["result"]["changed"]:
|
|
182
|
+
print(Fore.YELLOW, end="")
|
|
181
183
|
else:
|
|
182
|
-
|
|
184
|
+
print(Fore.GREEN, end="")
|
|
183
185
|
|
|
184
186
|
if data["result"]["output"]:
|
|
185
187
|
print(data["result"]["output"].rstrip("\n"))
|
|
@@ -119,7 +119,7 @@ class BatchFetchGit(BatchFetchBase):
|
|
|
119
119
|
|
|
120
120
|
self.add_output(
|
|
121
121
|
f"[GIT {update_type}] {self[self.main_key]}" +
|
|
122
|
-
(f" (
|
|
122
|
+
(f" (Ref: {self['reference']})"
|
|
123
123
|
if self["reference"] else "") + "\n"
|
|
124
124
|
)
|
|
125
125
|
|
|
@@ -218,27 +218,35 @@ class BatchFetchGit(BatchFetchBase):
|
|
|
218
218
|
try:
|
|
219
219
|
self._git_tags(self["reference"])
|
|
220
220
|
except GitReferenceDoesNotExist:
|
|
221
|
-
|
|
221
|
+
# The reference does not exist. We should maybe git pull
|
|
222
|
+
# in case the reference is in a new commit.
|
|
223
|
+
ignore_git_pull = False
|
|
222
224
|
else:
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
try:
|
|
227
|
-
commit_ref = self._git_ref(cwd=self.git_local_dir)
|
|
228
|
-
except subprocess.CalledProcessError:
|
|
229
|
-
# Ignore git pull because the head is detached
|
|
230
|
-
pass
|
|
225
|
+
if self.current_branch and \
|
|
226
|
+
self.current_branch == self["reference"]:
|
|
227
|
+
ignore_git_pull = False
|
|
231
228
|
else:
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
229
|
+
# The reference exists:
|
|
230
|
+
# 1. Ignore Git pull when the git reference is the same
|
|
231
|
+
# as the "branch:" key
|
|
232
|
+
try:
|
|
233
|
+
commit_ref = self._git_ref(cwd=self.git_local_dir)
|
|
234
|
+
except subprocess.CalledProcessError:
|
|
235
|
+
# Ignore git pull because the head is detached
|
|
236
|
+
pass
|
|
237
|
+
else:
|
|
238
|
+
# The head is not detached
|
|
239
|
+
# self.current_branch contains the current branch
|
|
240
|
+
if (commit_ref == self["reference"] or
|
|
241
|
+
(self.current_branch and
|
|
242
|
+
self.current_branch == self["reference"])):
|
|
243
|
+
ignore_git_pull = True
|
|
244
|
+
|
|
245
|
+
# 2. Ignore Git pull if it is not a local branch
|
|
246
|
+
if (not ignore_git_pull and
|
|
247
|
+
not self._git_is_local_branch(self["reference"])):
|
|
235
248
|
ignore_git_pull = True
|
|
236
249
|
|
|
237
|
-
# 2. Ignore Git pull if it is not a local branch
|
|
238
|
-
if (not ignore_git_pull and
|
|
239
|
-
not self._git_is_local_branch(self["reference"])):
|
|
240
|
-
ignore_git_pull = True
|
|
241
|
-
|
|
242
250
|
if ignore_git_pull:
|
|
243
251
|
self.add_output(self.indent_spaces +
|
|
244
252
|
"[INFO] git pull ignored\n")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|