p4cmd 2.10.0__tar.gz → 2.10.2__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 (31) hide show
  1. {p4cmd-2.10.0 → p4cmd-2.10.2}/PKG-INFO +1 -1
  2. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd/__init__.py +1 -1
  3. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd/p4cmd.py +2 -2
  4. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd.egg-info/PKG-INFO +1 -1
  5. {p4cmd-2.10.0 → p4cmd-2.10.2}/tests/test_p4client.py +32 -0
  6. {p4cmd-2.10.0 → p4cmd-2.10.2}/LICENSE +0 -0
  7. {p4cmd-2.10.0 → p4cmd-2.10.2}/README.md +0 -0
  8. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd/p4errors.py +0 -0
  9. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd/p4file.py +0 -0
  10. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd/resources/__init__.py +0 -0
  11. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd/resources/perforce_DEPOT_ONLY.png +0 -0
  12. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd/resources/perforce_MOVED.png +0 -0
  13. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd/resources/perforce_NEED_SYNC.png +0 -0
  14. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd/resources/perforce_OPEN_FOR_ADD.png +0 -0
  15. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd/resources/perforce_OPEN_FOR_DELETE.png +0 -0
  16. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd/resources/perforce_OPEN_FOR_EDIT.png +0 -0
  17. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd/resources/perforce_UNKNOWN.png +0 -0
  18. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd/resources/perforce_UNTRACKED.png +0 -0
  19. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd/resources/perforce_UP_TO_DATE.png +0 -0
  20. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd/utils.py +0 -0
  21. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd.egg-info/SOURCES.txt +0 -0
  22. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd.egg-info/dependency_links.txt +0 -0
  23. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd.egg-info/requires.txt +0 -0
  24. {p4cmd-2.10.0 → p4cmd-2.10.2}/p4cmd.egg-info/top_level.txt +0 -0
  25. {p4cmd-2.10.0 → p4cmd-2.10.2}/setup.cfg +0 -0
  26. {p4cmd-2.10.0 → p4cmd-2.10.2}/setup.py +0 -0
  27. {p4cmd-2.10.0 → p4cmd-2.10.2}/tests/__init__.py +0 -0
  28. {p4cmd-2.10.0 → p4cmd-2.10.2}/tests/conftest.py +0 -0
  29. {p4cmd-2.10.0 → p4cmd-2.10.2}/tests/test_integration.py +0 -0
  30. {p4cmd-2.10.0 → p4cmd-2.10.2}/tests/test_p4file.py +0 -0
  31. {p4cmd-2.10.0 → p4cmd-2.10.2}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: p4cmd
3
- Version: 2.10.0
3
+ Version: 2.10.2
4
4
  Summary: Simple P4 python module
5
5
  Home-page: https://github.com/nielsvaes/p4cmd
6
6
  Author: Niels Vaes
@@ -1,4 +1,4 @@
1
- VERSION = "2.10.0"
1
+ VERSION = "2.10.2"
2
2
 
3
3
  from .p4cmd import P4Client
4
4
  from .p4file import P4File
@@ -138,7 +138,7 @@ class P4Client(object):
138
138
  except ValueError as error:
139
139
  output_dict = {
140
140
  "command": command,
141
- "code": "error",
141
+ "code": "raw",
142
142
  "error": str(error),
143
143
  "raw_output": subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True, cwd=self.perforce_root)
144
144
  }
@@ -1302,7 +1302,7 @@ class P4Client(object):
1302
1302
  if p4file.local_file_path is None:
1303
1303
  data = self.__get_dict_value(file_dict, "data") or ""
1304
1304
  if " - " in data:
1305
- p4file.local_file_path = data.split(" - ")[0].strip()
1305
+ p4file.local_file_path = data.rsplit(" - ", 1)[0].strip()
1306
1306
  p4file.have_revision = self.__get_dict_value(file_dict, "haveRev")
1307
1307
  p4file.head_revision = self.__get_dict_value(file_dict, "headRev")
1308
1308
  p4file.last_submit_time = self.__get_dict_value(file_dict, "headTime")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: p4cmd
3
- Version: 2.10.0
3
+ Version: 2.10.2
4
4
  Summary: Simple P4 python module
5
5
  Home-page: https://github.com/nielsvaes/p4cmd
6
6
  Author: Niels Vaes
@@ -212,6 +212,20 @@ def test_fstat_actionowner_field(p4client):
212
212
  assert any("charlie@testclient" in entry for entry in files[0].checked_out_by)
213
213
 
214
214
 
215
+ def test_fstat_untracked_file_with_dash_in_name(p4client):
216
+ """fstat_to_p4_files correctly parses untracked file paths containing ' - '."""
217
+ fstat = [
218
+ {
219
+ b"code": b"error",
220
+ b"data": b"D:/p4/games/Animations/my_clip - Copy.pose - no such file(s).",
221
+ }
222
+ ]
223
+ with patch.object(p4client, "find_p4_client", return_value="testclient"):
224
+ files = p4client.fstat_to_p4_files(fstat)
225
+ assert len(files) == 1
226
+ assert files[0].local_file_path == "D:/p4/games/Animations/my_clip - Copy.pose"
227
+
228
+
215
229
  def test_fstat_invalid_revision_becomes_none(p4client):
216
230
  fstat = [
217
231
  make_fstat_dict(
@@ -653,6 +667,24 @@ def test_run_cmd_handles_string_key_error_dicts(p4client, caplog):
653
667
  assert "some error" in caplog.text
654
668
 
655
669
 
670
+ def test_run_cmd_value_error_fallback_no_warning(p4client, caplog):
671
+ """run_cmd's ValueError fallback (e.g. `p4 set`) must not log spurious error warnings."""
672
+ with patch("subprocess.Popen") as mock_popen, \
673
+ patch("p4cmd.p4cmd.subprocess.check_output", return_value=b"P4USER=niels.vaes (set)\n"):
674
+ # Empty stdout triggers ValueError on marshal.load (unknown type code in this case
675
+ # would also work; here we use bytes that aren't valid marshal data).
676
+ import io as _io
677
+ buf = _io.BytesIO(b"\xff\xff\xff\xff") # invalid marshal type code -> ValueError
678
+ mock_popen.return_value.__enter__ = lambda s: s
679
+ mock_popen.return_value.__exit__ = MagicMock(return_value=False)
680
+ mock_popen.return_value.stdout = buf
681
+ mock_popen.return_value.kill = MagicMock()
682
+ with caplog.at_level(logging.WARNING):
683
+ result = p4client.get_p4_setting("P4USER")
684
+ assert result == "niels.vaes"
685
+ assert caplog.records == []
686
+
687
+
656
688
  def test_get_local_paths_missing_path(p4client):
657
689
  """get_local_paths skips entries where path is missing (e.g. unmapped paths from p4 where)."""
658
690
  info_dicts = [
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