git-p4son 0.2.7__tar.gz → 0.2.8__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 (44) hide show
  1. {git_p4son-0.2.7 → git_p4son-0.2.8}/PKG-INFO +1 -1
  2. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/__init__.py +1 -1
  3. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/perforce.py +9 -0
  4. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son.egg-info/PKG-INFO +1 -1
  5. {git_p4son-0.2.7 → git_p4son-0.2.8}/pyproject.toml +1 -1
  6. {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_lib_edit.py +22 -0
  7. {git_p4son-0.2.7 → git_p4son-0.2.8}/LICENSE +0 -0
  8. {git_p4son-0.2.7 → git_p4son-0.2.8}/README.md +0 -0
  9. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/__main__.py +0 -0
  10. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/alias.py +0 -0
  11. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/changelist_store.py +0 -0
  12. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/cli.py +0 -0
  13. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/common.py +0 -0
  14. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/complete.py +0 -0
  15. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/completions/_git-p4son +0 -0
  16. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/completions/git-p4son.bash +0 -0
  17. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/completions/git-p4son.ps1 +0 -0
  18. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/config.py +0 -0
  19. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/git.py +0 -0
  20. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/init.py +0 -0
  21. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/lib.py +0 -0
  22. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/list_changes.py +0 -0
  23. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/log.py +0 -0
  24. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/new.py +0 -0
  25. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/review.py +0 -0
  26. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/sync.py +0 -0
  27. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/update.py +0 -0
  28. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son.egg-info/SOURCES.txt +0 -0
  29. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son.egg-info/dependency_links.txt +0 -0
  30. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son.egg-info/entry_points.txt +0 -0
  31. {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son.egg-info/top_level.txt +0 -0
  32. {git_p4son-0.2.7 → git_p4son-0.2.8}/setup.cfg +0 -0
  33. {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_cli.py +0 -0
  34. {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_common.py +0 -0
  35. {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_complete.py +0 -0
  36. {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_config.py +0 -0
  37. {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_init.py +0 -0
  38. {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_lib_changelist.py +0 -0
  39. {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_lib_review.py +0 -0
  40. {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_list_changes.py +0 -0
  41. {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_log.py +0 -0
  42. {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_perforce.py +0 -0
  43. {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_review.py +0 -0
  44. {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_sync.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-p4son
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: Utility for keeping a Perforce workspace and local git repo in sync
5
5
  Author-email: Andreas Andersson <andreas@neoboid.com>
6
6
  License-Expression: MIT
@@ -7,6 +7,6 @@ creating and updating changelists, and managing Swarm reviews.
7
7
 
8
8
  CONFIG_DIR = '.git-p4son'
9
9
 
10
- __version__ = "0.2.7"
10
+ __version__ = "0.2.8"
11
11
  __author__ = "Andreas Andersson"
12
12
  __email__ = "andreas@neoboid.com"
@@ -207,6 +207,15 @@ def _ensure_in_changelist(filename: str, p4_action: str, changelist: str,
207
207
  # Action mismatch - revert first, then reopen with correct action.
208
208
  # p4 revert overwrites the file on disk with the depot version,
209
209
  # so we need git restore afterwards to get the git content back.
210
+
211
+ # add -> edit: the file is new to the depot, so it must stay as add.
212
+ # This happens when a file is added in one commit and modified in the next.
213
+ if current_action == 'add' and p4_action == 'edit':
214
+ if current_cl != changelist:
215
+ run(['p4', 'reopen', '-c', changelist, filename],
216
+ cwd=workspace_dir, dry_run=dry_run)
217
+ return
218
+
210
219
  run(['p4', 'revert', filename], cwd=workspace_dir, dry_run=dry_run)
211
220
  # For add -> delete: the file never existed in the depot, so just revert.
212
221
  if current_action == 'add' and p4_action == 'delete':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-p4son
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: Utility for keeping a Perforce workspace and local git repo in sync
5
5
  Author-email: Andreas Andersson <andreas@neoboid.com>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "git-p4son"
7
- version = "0.2.7"
7
+ version = "0.2.8"
8
8
  description = "Utility for keeping a Perforce workspace and local git repo in sync"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -350,6 +350,28 @@ class TestActionMismatch(unittest.TestCase):
350
350
  self.assertEqual(calls[2][0][0],
351
351
  ['git', 'restore', 'file.txt'])
352
352
 
353
+ # --- add -> edit (keep as add, file is new to depot) ---
354
+ @mock.patch('git_p4son.perforce.get_changelist_for_file', return_value=('100', 'add'))
355
+ @mock.patch('git_p4son.perforce.run')
356
+ def test_add_to_edit_same_cl_keeps_add(self, mock_run, mock_check):
357
+ mock_run.return_value = make_run_result()
358
+ changes = LocalChanges()
359
+ changes.mods = ['file.txt']
360
+ include_changes_in_changelist(changes, '100', '/ws')
361
+ mock_run.assert_not_called()
362
+
363
+ @mock.patch('git_p4son.perforce.get_changelist_for_file', return_value=('200', 'add'))
364
+ @mock.patch('git_p4son.perforce.run')
365
+ def test_add_to_edit_different_cl_reopens(self, mock_run, mock_check):
366
+ mock_run.return_value = make_run_result()
367
+ changes = LocalChanges()
368
+ changes.mods = ['file.txt']
369
+ include_changes_in_changelist(changes, '100', '/ws')
370
+ mock_run.assert_called_once_with(
371
+ ['p4', 'reopen', '-c', '100', 'file.txt'],
372
+ cwd='/ws', dry_run=False,
373
+ )
374
+
353
375
  # --- add -> delete (revert only, no reopen) ---
354
376
  @mock.patch('git_p4son.perforce.get_changelist_for_file', return_value=('100', 'add'))
355
377
  @mock.patch('git_p4son.perforce.run')
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
File without changes
File without changes