batchfetch 1.0.3__tar.gz → 1.0.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.0.3/batchfetch.egg-info → batchfetch-1.0.4}/PKG-INFO +1 -1
  2. {batchfetch-1.0.3 → batchfetch-1.0.4}/batchfetch/batchfetch_base.py +1 -1
  3. {batchfetch-1.0.3 → batchfetch-1.0.4}/batchfetch/batchfetch_git.py +27 -7
  4. {batchfetch-1.0.3 → batchfetch-1.0.4/batchfetch.egg-info}/PKG-INFO +1 -1
  5. {batchfetch-1.0.3 → batchfetch-1.0.4}/setup.py +1 -1
  6. {batchfetch-1.0.3 → batchfetch-1.0.4}/.gitignore +0 -0
  7. {batchfetch-1.0.3 → batchfetch-1.0.4}/LICENSE +0 -0
  8. {batchfetch-1.0.3 → batchfetch-1.0.4}/README.md +0 -0
  9. {batchfetch-1.0.3 → batchfetch-1.0.4}/batchfetch/__init__.py +0 -0
  10. {batchfetch-1.0.3 → batchfetch-1.0.4}/batchfetch/batchfetch_cli.py +0 -0
  11. {batchfetch-1.0.3 → batchfetch-1.0.4}/batchfetch/helpers.py +0 -0
  12. {batchfetch-1.0.3 → batchfetch-1.0.4}/batchfetch.egg-info/SOURCES.txt +0 -0
  13. {batchfetch-1.0.3 → batchfetch-1.0.4}/batchfetch.egg-info/dependency_links.txt +0 -0
  14. {batchfetch-1.0.3 → batchfetch-1.0.4}/batchfetch.egg-info/entry_points.txt +0 -0
  15. {batchfetch-1.0.3 → batchfetch-1.0.4}/batchfetch.egg-info/requires.txt +0 -0
  16. {batchfetch-1.0.3 → batchfetch-1.0.4}/batchfetch.egg-info/top_level.txt +0 -0
  17. {batchfetch-1.0.3 → batchfetch-1.0.4}/run_tests.sh +0 -0
  18. {batchfetch-1.0.3 → batchfetch-1.0.4}/setup.cfg +0 -0
  19. {batchfetch-1.0.3 → batchfetch-1.0.4}/tests/data/test-md5sum.txt +0 -0
  20. {batchfetch-1.0.3 → batchfetch-1.0.4}/tests/data/test-run_simple.sh +0 -0
  21. {batchfetch-1.0.3 → batchfetch-1.0.4}/tests/test_helpers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: batchfetch
3
- Version: 1.0.3
3
+ Version: 1.0.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
@@ -113,7 +113,7 @@ class BatchFetchBase:
113
113
 
114
114
  if not stdout.endswith("\n"):
115
115
  stdout += "\n"
116
- self.add_output((" " * self.indent) + stdout)
116
+ self.add_output(stdout)
117
117
 
118
118
  def _run_pre_exec(self, cwd: os.PathLike = Path(".")):
119
119
  self._initialize_data()
@@ -209,16 +209,19 @@ class BatchFetchGit(BatchFetchBase):
209
209
  try:
210
210
  self._git_tags(self["branch"])
211
211
  except GitBranchDoesNotExist:
212
- ignore_git_pull = False
212
+ pass
213
213
  else:
214
214
  # The branch exists
215
- ignore_git_pull = True
216
215
 
217
- # Check if the new branch is different from the current one
218
- commit_ref = self._git_ref(cwd=self.git_local_dir)
219
- if self.current_branch and (commit_ref == self["branch"] or
220
- self.current_branch == self["branch"]):
221
- ignore_git_pull = True
216
+ # Ignore Git pull when the git reference is the same
217
+ commit_ref = self._git_ref(cwd=self.git_local_dir)
218
+ if (self.current_branch and
219
+ (commit_ref == self["branch"] or
220
+ self.current_branch == self["branch"])):
221
+ ignore_git_pull = True
222
+ # Ignore Git pull if it is not a local branch
223
+ elif not self._git_is_local_branch(self["branch"]):
224
+ ignore_git_pull = True
222
225
 
223
226
  if ignore_git_pull:
224
227
  self.add_output(self.indent_spaces +
@@ -244,6 +247,23 @@ class BatchFetchGit(BatchFetchBase):
244
247
 
245
248
  return git_merge
246
249
 
250
+ def _git_is_local_branch(self, branch: str) -> bool:
251
+ try:
252
+ stdout, _ = run_simple(["git", "rev-parse", "--symbolic-full-name",
253
+ branch], env=self.env,
254
+ cwd=self.git_local_dir)
255
+ if not stdout:
256
+ return False
257
+
258
+ full_branch_name = stdout[0].strip()
259
+
260
+ if full_branch_name.startswith("refs/heads/"):
261
+ return True
262
+ except subprocess.CalledProcessError:
263
+ pass
264
+
265
+ return False
266
+
247
267
  def _git_tags(self, branch: str) -> List[str]:
248
268
  stdout: List[str] = []
249
269
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: batchfetch
3
- Version: 1.0.3
3
+ Version: 1.0.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.0.3",
25
+ version="1.0.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