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.
- {git_p4son-0.2.7 → git_p4son-0.2.8}/PKG-INFO +1 -1
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/__init__.py +1 -1
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/perforce.py +9 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son.egg-info/PKG-INFO +1 -1
- {git_p4son-0.2.7 → git_p4son-0.2.8}/pyproject.toml +1 -1
- {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_lib_edit.py +22 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/LICENSE +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/README.md +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/__main__.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/alias.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/changelist_store.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/cli.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/common.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/complete.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/completions/_git-p4son +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/completions/git-p4son.bash +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/completions/git-p4son.ps1 +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/config.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/git.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/init.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/lib.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/list_changes.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/log.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/new.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/review.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/sync.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son/update.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son.egg-info/SOURCES.txt +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son.egg-info/dependency_links.txt +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son.egg-info/entry_points.txt +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/git_p4son.egg-info/top_level.txt +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/setup.cfg +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_cli.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_common.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_complete.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_config.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_init.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_lib_changelist.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_lib_review.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_list_changes.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_log.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_perforce.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_review.py +0 -0
- {git_p4son-0.2.7 → git_p4son-0.2.8}/tests/test_sync.py +0 -0
|
@@ -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':
|
|
@@ -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
|
|
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
|