batchfetch 1.1.3__tar.gz → 1.1.5__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.1.3/batchfetch.egg-info → batchfetch-1.1.5}/PKG-INFO +1 -1
- {batchfetch-1.1.3 → batchfetch-1.1.5}/batchfetch/batchfetch_git.py +36 -32
- {batchfetch-1.1.3 → batchfetch-1.1.5/batchfetch.egg-info}/PKG-INFO +1 -1
- {batchfetch-1.1.3 → batchfetch-1.1.5}/setup.py +1 -1
- {batchfetch-1.1.3 → batchfetch-1.1.5}/.gitignore +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.5}/LICENSE +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.5}/README.md +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.5}/batchfetch/__init__.py +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.5}/batchfetch/batchfetch_base.py +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.5}/batchfetch/batchfetch_cli.py +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.5}/batchfetch/helpers.py +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.5}/batchfetch.egg-info/SOURCES.txt +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.5}/batchfetch.egg-info/dependency_links.txt +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.5}/batchfetch.egg-info/entry_points.txt +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.5}/batchfetch.egg-info/requires.txt +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.5}/batchfetch.egg-info/top_level.txt +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.5}/run_tests.sh +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.5}/setup.cfg +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.5}/tests/data/test-md5sum.txt +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.5}/tests/data/test-run_simple.sh +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.5}/tests/test_helpers.py +0 -0
|
@@ -46,6 +46,9 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
46
46
|
def __init__(self, *args, **kwargs):
|
|
47
47
|
self._git_fetch_origin_done = False
|
|
48
48
|
|
|
49
|
+
self.branch_commit_ref = None
|
|
50
|
+
self.is_branch = False
|
|
51
|
+
|
|
49
52
|
super().__init__(*args, **kwargs)
|
|
50
53
|
self.env["GIT_TERMINAL_PROMPT"] = "0"
|
|
51
54
|
self.env["GIT_PAGER"] = ""
|
|
@@ -132,7 +135,10 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
132
135
|
self._repo_reset()
|
|
133
136
|
|
|
134
137
|
git_merge_done = self._repo_pull()
|
|
135
|
-
git_branch_changed =
|
|
138
|
+
git_branch_changed = False
|
|
139
|
+
if self.is_branch:
|
|
140
|
+
git_branch_changed = self._repo_fix_branch()
|
|
141
|
+
|
|
136
142
|
if git_merge_done or git_branch_changed:
|
|
137
143
|
self._repo_update_submodules()
|
|
138
144
|
|
|
@@ -179,6 +185,19 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
179
185
|
# Not a symbolic ref
|
|
180
186
|
self.current_branch = None
|
|
181
187
|
|
|
188
|
+
if self.current_branch:
|
|
189
|
+
try:
|
|
190
|
+
# If the tag is annotated, it points to a tag object, not
|
|
191
|
+
# directly to a commit. You need to resolve it to the
|
|
192
|
+
# commit it points to. Using `git rev-parse
|
|
193
|
+
# <tagname>^{commit}` allows getting the right reference.
|
|
194
|
+
commit_ref = self._git_tags("origin/" + self["reference"] +
|
|
195
|
+
"^{commit}")[0]
|
|
196
|
+
self.branch_commit_ref = commit_ref.strip().lower()
|
|
197
|
+
self.is_branch = True
|
|
198
|
+
except GitReferenceDoesNotExist:
|
|
199
|
+
pass
|
|
200
|
+
|
|
182
201
|
def _repo_delete(self):
|
|
183
202
|
if not self.git_local_dir.exists():
|
|
184
203
|
self.add_output(self.indent_spaces + "[INFO] Already deleted\n")
|
|
@@ -215,11 +234,10 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
215
234
|
# Merge
|
|
216
235
|
do_git_pull = self["git_pull"]
|
|
217
236
|
if not self["reference"]:
|
|
218
|
-
|
|
219
|
-
|
|
237
|
+
do_git_pull = True
|
|
238
|
+
self.add_output(self.indent_spaces +
|
|
220
239
|
"[INFO] Git fetch origin reason: " +
|
|
221
|
-
|
|
222
|
-
"\n")
|
|
240
|
+
"No 'reference:' specified\n")
|
|
223
241
|
else:
|
|
224
242
|
do_git_pull = False
|
|
225
243
|
commit_ref = None
|
|
@@ -232,29 +250,14 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
232
250
|
except GitReferenceDoesNotExist:
|
|
233
251
|
pass
|
|
234
252
|
|
|
235
|
-
if not commit_ref:
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
commit_ref = self._git_tags("origin/" + self["reference"] +
|
|
242
|
-
"^{commit}")[0]
|
|
243
|
-
commit_ref = commit_ref.strip().lower()
|
|
244
|
-
except GitReferenceDoesNotExist:
|
|
245
|
-
# The branch does not exist. We should git pull in case we
|
|
246
|
-
# can get the reference
|
|
247
|
-
do_git_pull = True
|
|
248
|
-
self.add_output(
|
|
249
|
-
self.indent_spaces +
|
|
250
|
-
"[INFO] Git fetch origin reason:" +
|
|
251
|
-
f"The reference does not exist: {self['reference']}" +
|
|
252
|
-
"\n")
|
|
253
|
-
|
|
253
|
+
if not commit_ref and not self.is_branch:
|
|
254
|
+
self.add_output(
|
|
255
|
+
self.indent_spaces +
|
|
256
|
+
"[INFO] Git fetch origin reason:" +
|
|
257
|
+
f"The reference does not exist: {self['reference']}" +
|
|
258
|
+
"\n")
|
|
254
259
|
|
|
255
260
|
if not do_git_pull:
|
|
256
|
-
# Check if it is a branch or a tag such as 1.1.3
|
|
257
|
-
is_tag = False
|
|
258
261
|
try:
|
|
259
262
|
# Check if the branch is a tag or a branch
|
|
260
263
|
cmd = ["git", "show-ref", "--verify", "--quiet",
|
|
@@ -302,10 +305,11 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
302
305
|
|
|
303
306
|
# Merge
|
|
304
307
|
real_branch = self._git_is_local_branch("HEAD")
|
|
305
|
-
if real_branch:
|
|
308
|
+
if real_branch and self.current_branch:
|
|
306
309
|
# TODO: only merge when difference from upstream
|
|
307
310
|
commit_ref_head = self._git_ref(cwd=self.git_local_dir)
|
|
308
|
-
self._run(["git", "merge", "--ff-only"
|
|
311
|
+
self._run(["git", "merge", "--ff-only",
|
|
312
|
+
f"origin/{self.current_branch}"],
|
|
309
313
|
cwd=str(self.git_local_dir), env=self.env)
|
|
310
314
|
git_ref_after_merge = self._git_ref(cwd=self.git_local_dir)
|
|
311
315
|
if commit_ref_head != git_ref_after_merge:
|
|
@@ -353,8 +357,7 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
353
357
|
origin_url = stdout[0]
|
|
354
358
|
except (subprocess.CalledProcessError, IndexError) as err:
|
|
355
359
|
raise GitRemoteError(
|
|
356
|
-
f"Failed to modify the Git remote url: {remote_name}")
|
|
357
|
-
from err
|
|
360
|
+
f"Failed to modify the Git remote url: {remote_name}") from err
|
|
358
361
|
|
|
359
362
|
return origin_url
|
|
360
363
|
|
|
@@ -408,7 +411,8 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
408
411
|
# Also check the commit reference in case
|
|
409
412
|
# branch is a commit reference instead of a tag
|
|
410
413
|
try:
|
|
411
|
-
git_ref_branch = self._git_tags(
|
|
414
|
+
git_ref_branch = self._git_tags("origin/" +
|
|
415
|
+
self["reference"] +
|
|
412
416
|
"^{commit}")[0]
|
|
413
417
|
except GitReferenceDoesNotExist as err:
|
|
414
418
|
raise BatchFetchError(f"The branch '{self['reference']}' "
|
|
@@ -486,7 +490,7 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
486
490
|
self._git_fetch_origin()
|
|
487
491
|
|
|
488
492
|
cmd = ["git", "branch",
|
|
489
|
-
|
|
493
|
+
f"--set-upstream-to=origin/{self.current_branch}"]
|
|
490
494
|
_, _ = run_simple(cmd, env=self.env,
|
|
491
495
|
cwd=self.git_local_dir)
|
|
492
496
|
# TODO: handle errors
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|