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.
Files changed (21) hide show
  1. {batchfetch-1.1.3/batchfetch.egg-info → batchfetch-1.1.4}/PKG-INFO +1 -1
  2. {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch/batchfetch_git.py +33 -28
  3. {batchfetch-1.1.3 → batchfetch-1.1.4/batchfetch.egg-info}/PKG-INFO +1 -1
  4. {batchfetch-1.1.3 → batchfetch-1.1.4}/setup.py +1 -1
  5. {batchfetch-1.1.3 → batchfetch-1.1.4}/.gitignore +0 -0
  6. {batchfetch-1.1.3 → batchfetch-1.1.4}/LICENSE +0 -0
  7. {batchfetch-1.1.3 → batchfetch-1.1.4}/README.md +0 -0
  8. {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch/__init__.py +0 -0
  9. {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch/batchfetch_base.py +0 -0
  10. {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch/batchfetch_cli.py +0 -0
  11. {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch/helpers.py +0 -0
  12. {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch.egg-info/SOURCES.txt +0 -0
  13. {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch.egg-info/dependency_links.txt +0 -0
  14. {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch.egg-info/entry_points.txt +0 -0
  15. {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch.egg-info/requires.txt +0 -0
  16. {batchfetch-1.1.3 → batchfetch-1.1.4}/batchfetch.egg-info/top_level.txt +0 -0
  17. {batchfetch-1.1.3 → batchfetch-1.1.4}/run_tests.sh +0 -0
  18. {batchfetch-1.1.3 → batchfetch-1.1.4}/setup.cfg +0 -0
  19. {batchfetch-1.1.3 → batchfetch-1.1.4}/tests/data/test-md5sum.txt +0 -0
  20. {batchfetch-1.1.3 → batchfetch-1.1.4}/tests/data/test-run_simple.sh +0 -0
  21. {batchfetch-1.1.3 → batchfetch-1.1.4}/tests/test_helpers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: batchfetch
3
- Version: 1.1.3
3
+ Version: 1.1.4
4
4
  Summary: Efficiently clone and pull multiple Git repositories.
5
5
  Home-page: https://github.com/jamescherti/batchfetch
6
6
  Author: James Cherti
@@ -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 = self._repo_fix_branch()
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
- try:
237
- # If the tag is annotated, it points to a tag object, not
238
- # directly to a commit. You need to resolve it to the
239
- # commit it points to. Using `git rev-parse
240
- # <tagname>^{commit}` allows getting the right reference.
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(self["reference"] +
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
- f"--set-upstream-to=origin/{self.current_branch}"]
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: batchfetch
3
- Version: 1.1.3
3
+ Version: 1.1.4
4
4
  Summary: Efficiently clone and pull multiple Git repositories.
5
5
  Home-page: https://github.com/jamescherti/batchfetch
6
6
  Author: James Cherti
@@ -22,7 +22,7 @@ from setuptools import find_packages, setup
22
22
 
23
23
  setup(
24
24
  name="batchfetch",
25
- version="1.1.3",
25
+ version="1.1.4",
26
26
  packages=find_packages(),
27
27
  description="Efficiently clone and pull multiple Git repositories.",
28
28
  license="GPLv3",
File without changes
File without changes
File without changes
File without changes
File without changes