batchfetch 1.1.3__tar.gz → 1.1.4__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.4}/PKG-INFO +1 -1
- {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch/batchfetch_git.py +33 -28
- {batchfetch-1.1.3 → batchfetch-1.1.4/batchfetch.egg-info}/PKG-INFO +1 -1
- {batchfetch-1.1.3 → batchfetch-1.1.4}/setup.py +1 -1
- {batchfetch-1.1.3 → batchfetch-1.1.4}/.gitignore +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.4}/LICENSE +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.4}/README.md +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch/__init__.py +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch/batchfetch_base.py +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch/batchfetch_cli.py +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch/helpers.py +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch.egg-info/SOURCES.txt +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch.egg-info/dependency_links.txt +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch.egg-info/entry_points.txt +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch.egg-info/requires.txt +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch.egg-info/top_level.txt +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.4}/run_tests.sh +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.4}/setup.cfg +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.4}/tests/data/test-md5sum.txt +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.4}/tests/data/test-run_simple.sh +0 -0
- {batchfetch-1.1.3 → batchfetch-1.1.4}/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")
|
|
@@ -232,29 +251,14 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
232
251
|
except GitReferenceDoesNotExist:
|
|
233
252
|
pass
|
|
234
253
|
|
|
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
|
-
|
|
254
|
+
if not commit_ref and not self.is_branch:
|
|
255
|
+
self.add_output(
|
|
256
|
+
self.indent_spaces +
|
|
257
|
+
"[INFO] Git fetch origin reason:" +
|
|
258
|
+
f"The reference does not exist: {self['reference']}" +
|
|
259
|
+
"\n")
|
|
254
260
|
|
|
255
261
|
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
262
|
try:
|
|
259
263
|
# Check if the branch is a tag or a branch
|
|
260
264
|
cmd = ["git", "show-ref", "--verify", "--quiet",
|
|
@@ -302,10 +306,11 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
302
306
|
|
|
303
307
|
# Merge
|
|
304
308
|
real_branch = self._git_is_local_branch("HEAD")
|
|
305
|
-
if real_branch:
|
|
309
|
+
if real_branch and self.current_branch:
|
|
306
310
|
# TODO: only merge when difference from upstream
|
|
307
311
|
commit_ref_head = self._git_ref(cwd=self.git_local_dir)
|
|
308
|
-
self._run(["git", "merge", "--ff-only"
|
|
312
|
+
self._run(["git", "merge", "--ff-only",
|
|
313
|
+
f"origin/{self.current_branch}"],
|
|
309
314
|
cwd=str(self.git_local_dir), env=self.env)
|
|
310
315
|
git_ref_after_merge = self._git_ref(cwd=self.git_local_dir)
|
|
311
316
|
if commit_ref_head != git_ref_after_merge:
|
|
@@ -353,8 +358,7 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
353
358
|
origin_url = stdout[0]
|
|
354
359
|
except (subprocess.CalledProcessError, IndexError) as err:
|
|
355
360
|
raise GitRemoteError(
|
|
356
|
-
f"Failed to modify the Git remote url: {remote_name}")
|
|
357
|
-
from err
|
|
361
|
+
f"Failed to modify the Git remote url: {remote_name}") from err
|
|
358
362
|
|
|
359
363
|
return origin_url
|
|
360
364
|
|
|
@@ -408,7 +412,8 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
408
412
|
# Also check the commit reference in case
|
|
409
413
|
# branch is a commit reference instead of a tag
|
|
410
414
|
try:
|
|
411
|
-
git_ref_branch = self._git_tags(
|
|
415
|
+
git_ref_branch = self._git_tags("origin/" +
|
|
416
|
+
self["reference"] +
|
|
412
417
|
"^{commit}")[0]
|
|
413
418
|
except GitReferenceDoesNotExist as err:
|
|
414
419
|
raise BatchFetchError(f"The branch '{self['reference']}' "
|
|
@@ -486,7 +491,7 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
486
491
|
self._git_fetch_origin()
|
|
487
492
|
|
|
488
493
|
cmd = ["git", "branch",
|
|
489
|
-
|
|
494
|
+
f"--set-upstream-to=origin/{self.current_branch}"]
|
|
490
495
|
_, _ = run_simple(cmd, env=self.env,
|
|
491
496
|
cwd=self.git_local_dir)
|
|
492
497
|
# 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
|