batchfetch 1.0.9__tar.gz → 1.1.0__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.9/batchfetch.egg-info → batchfetch-1.1.0}/PKG-INFO +1 -1
  2. {batchfetch-1.0.9 → batchfetch-1.1.0}/batchfetch/batchfetch_git.py +40 -32
  3. {batchfetch-1.0.9 → batchfetch-1.1.0/batchfetch.egg-info}/PKG-INFO +1 -1
  4. {batchfetch-1.0.9 → batchfetch-1.1.0}/setup.py +1 -1
  5. {batchfetch-1.0.9 → batchfetch-1.1.0}/.gitignore +0 -0
  6. {batchfetch-1.0.9 → batchfetch-1.1.0}/LICENSE +0 -0
  7. {batchfetch-1.0.9 → batchfetch-1.1.0}/README.md +0 -0
  8. {batchfetch-1.0.9 → batchfetch-1.1.0}/batchfetch/__init__.py +0 -0
  9. {batchfetch-1.0.9 → batchfetch-1.1.0}/batchfetch/batchfetch_base.py +0 -0
  10. {batchfetch-1.0.9 → batchfetch-1.1.0}/batchfetch/batchfetch_cli.py +0 -0
  11. {batchfetch-1.0.9 → batchfetch-1.1.0}/batchfetch/helpers.py +0 -0
  12. {batchfetch-1.0.9 → batchfetch-1.1.0}/batchfetch.egg-info/SOURCES.txt +0 -0
  13. {batchfetch-1.0.9 → batchfetch-1.1.0}/batchfetch.egg-info/dependency_links.txt +0 -0
  14. {batchfetch-1.0.9 → batchfetch-1.1.0}/batchfetch.egg-info/entry_points.txt +0 -0
  15. {batchfetch-1.0.9 → batchfetch-1.1.0}/batchfetch.egg-info/requires.txt +0 -0
  16. {batchfetch-1.0.9 → batchfetch-1.1.0}/batchfetch.egg-info/top_level.txt +0 -0
  17. {batchfetch-1.0.9 → batchfetch-1.1.0}/run_tests.sh +0 -0
  18. {batchfetch-1.0.9 → batchfetch-1.1.0}/setup.cfg +0 -0
  19. {batchfetch-1.0.9 → batchfetch-1.1.0}/tests/data/test-md5sum.txt +0 -0
  20. {batchfetch-1.0.9 → batchfetch-1.1.0}/tests/data/test-run_simple.sh +0 -0
  21. {batchfetch-1.0.9 → batchfetch-1.1.0}/tests/test_helpers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: batchfetch
3
- Version: 1.0.9
3
+ Version: 1.1.0
4
4
  Summary: Efficiently clone and pull multiple Git repositories.
5
5
  Home-page: https://github.com/jamescherti/batchfetch
6
6
  Author: James Cherti
@@ -209,57 +209,65 @@ class BatchFetchGit(BatchFetchBase):
209
209
 
210
210
  # Merge
211
211
  do_git_pull = self["git_pull"]
212
- disable_merge = False
213
212
  if self["reference"]:
213
+ do_git_pull = False
214
214
  commit_ref = None
215
+
215
216
  try:
216
217
  # Returns the commit ref of the branch or commit
217
- commit_ref = self._git_tags(self["reference"])[0]
218
+ #
219
+ # If the tag is annotated, it points to a tag object, not
220
+ # directly to a commit. You need to resolve it to the commit it
221
+ # points to. Using `git rev-parse <tagname>^{commit}` allows
222
+ # getting the right reference.
223
+ commit_ref = self._git_tags(self["reference"] + "^{commit}")[0]
218
224
  except GitReferenceDoesNotExist:
219
- # The reference does not exist. We should git pull
220
- # in case we can get the reference
225
+ # The wanted reference does not exist. We should git pull in
226
+ # case we can get the reference
221
227
  do_git_pull = True
222
228
  else: # The reference exists
223
- if not self._git_is_local_branch(self["reference"]):
224
- # This is not a real branch where we can merge
225
- disable_merge = True
226
-
227
229
  try:
228
- # Returns the commit ref of the branch or commit
229
- commit_ref_head = self._git_tags("HEAD")[0]
230
+ # If the tag is annotated, it points to a tag object, not
231
+ # directly to a commit. You need to resolve it to the
232
+ # commit it points to. Using `git rev-parse
233
+ # <tagname>^{commit}` allows getting the right reference.
234
+ commit_ref_head = self._git_tags("HEAD^{commit}")[0]
230
235
  except GitReferenceDoesNotExist:
231
236
  # HEAD is detached
232
237
  commit_ref_head = None
233
238
 
234
239
  # The wanted commit reference does not exist
235
240
  # Or the commit ref of HEAD hasn't changed
236
- if not commit_ref or commit_ref_head != commit_ref:
237
- do_git_pull = True
238
- else:
241
+ if commit_ref and commit_ref_head == commit_ref:
239
242
  do_git_pull = False
243
+ else:
244
+ do_git_pull = True
240
245
 
241
246
  if not do_git_pull:
242
- self.add_output(self.indent_spaces +
243
- "[INFO] git pull ignored\n")
244
- else:
245
- cmd = ["git", "fetch", "origin"]
246
- self._run(cmd, cwd=str(self.git_local_dir), env=self.env)
247
+ self.add_output(self.indent_spaces + "[INFO] git pull ignored\n")
248
+ return git_merge
249
+
250
+ # Fetch
251
+ cmd = ["git", "fetch", "origin"]
252
+ self._run(cmd, cwd=str(self.git_local_dir), env=self.env)
247
253
 
248
- # TODO: only merge when difference from upstream
254
+ # Merge
255
+ real_branch = self._git_is_local_branch("HEAD")
256
+ if real_branch:
257
+ # TODO: only merge when difference from upstream
249
258
  commit_ref_head = self._git_ref(cwd=self.git_local_dir)
250
- if not disable_merge:
251
- self._run(["git", "merge", "--ff-only"],
252
- cwd=str(self.git_local_dir), env=self.env)
253
- git_ref_after_merge = self._git_ref(cwd=self.git_local_dir)
254
- if commit_ref_head != git_ref_after_merge:
255
- git_merge = True
256
- self.set_changed(True)
257
- self._run(["git", "log",
258
- '--pretty=format:"%h %ad %s [%cn]"',
259
- "--decorate", "--date=short",
260
- f"{commit_ref_head}..{git_ref_after_merge}"],
261
- cwd=str(self.git_local_dir),
262
- env=self.env)
259
+ self._run(["git", "merge", "--ff-only"],
260
+ cwd=str(self.git_local_dir), env=self.env)
261
+ git_ref_after_merge = self._git_ref(cwd=self.git_local_dir)
262
+ if commit_ref_head != git_ref_after_merge:
263
+ git_merge = True
264
+ self.set_changed(True)
265
+ self._run(["git", "log",
266
+ '--pretty=format:"%h %ad %s [%cn]"',
267
+ "--decorate", "--date=short",
268
+ f"{commit_ref_head}..{git_ref_after_merge}"],
269
+ cwd=str(self.git_local_dir),
270
+ env=self.env)
263
271
 
264
272
  return git_merge
265
273
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: batchfetch
3
- Version: 1.0.9
3
+ Version: 1.1.0
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.9",
25
+ version="1.1.0",
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