p4cmd 2.8.2__tar.gz → 2.8.5__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 (24) hide show
  1. {p4cmd-2.8.2 → p4cmd-2.8.5}/PKG-INFO +1 -1
  2. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd/__init__.py +1 -1
  3. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd/p4cmd.py +65 -10
  4. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd.egg-info/PKG-INFO +1 -1
  5. {p4cmd-2.8.2 → p4cmd-2.8.5}/LICENSE +0 -0
  6. {p4cmd-2.8.2 → p4cmd-2.8.5}/README.md +0 -0
  7. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd/p4errors.py +0 -0
  8. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd/p4file.py +0 -0
  9. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd/resources/__init__.py +0 -0
  10. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd/resources/perforce_DEPOT_ONLY.png +0 -0
  11. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd/resources/perforce_MOVED.png +0 -0
  12. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd/resources/perforce_NEED_SYNC.png +0 -0
  13. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd/resources/perforce_OPEN_FOR_ADD.png +0 -0
  14. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd/resources/perforce_OPEN_FOR_DELETE.png +0 -0
  15. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd/resources/perforce_OPEN_FOR_EDIT.png +0 -0
  16. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd/resources/perforce_UNKNOWN.png +0 -0
  17. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd/resources/perforce_UNTRACKED.png +0 -0
  18. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd/resources/perforce_UP_TO_DATE.png +0 -0
  19. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd/utils.py +0 -0
  20. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd.egg-info/SOURCES.txt +0 -0
  21. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd.egg-info/dependency_links.txt +0 -0
  22. {p4cmd-2.8.2 → p4cmd-2.8.5}/p4cmd.egg-info/top_level.txt +0 -0
  23. {p4cmd-2.8.2 → p4cmd-2.8.5}/setup.cfg +0 -0
  24. {p4cmd-2.8.2 → p4cmd-2.8.5}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: p4cmd
3
- Version: 2.8.2
3
+ Version: 2.8.5
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.8.2"
1
+ VERSION = "2.8.5"
2
2
 
3
3
  from .p4cmd import P4Client
4
4
  from .p4file import P4File
@@ -243,7 +243,7 @@ class P4Client(object):
243
243
  return p4files
244
244
 
245
245
  @validate_not_empty
246
- def folder_to_p4files(self, folder, include_subfolders=True, allow_invalid_files=False):
246
+ def folder_to_p4files(self, folder, include_subfolders=True, allow_invalid_files=False, specific_file_filter=""):
247
247
  """
248
248
  Returns all the files in a folder as a list of P4File objects. Uses the files_to_p4files function if the host
249
249
  is offline
@@ -252,14 +252,25 @@ class P4Client(object):
252
252
  :param include_subfolders: *bool*
253
253
  :param allow_invalid_files: *bool* if set to False, this function will skip any files that are deleted or
254
254
  marked for delte
255
+ :param specific_file_filter: *string* will only return files that have this specific string in it. Can be used
256
+ for file extensions or just part of the file
255
257
  :return: *list* P4Files
256
258
  """
257
259
 
260
+ folder = folder.rstrip(r"/")
261
+ folder = folder.rstrip(r"\\")
262
+
258
263
  if self.host_online():
259
264
  if include_subfolders:
260
- folder = folder + "..." if folder.endswith("/") or folder.endswith("\\") else folder + "/..."
265
+ if specific_file_filter:
266
+ folder = folder + f"/.../*{specific_file_filter}*"
267
+ else:
268
+ folder = folder + "/..."
261
269
  else:
262
- folder = folder + "*" if folder.endswith("/") or folder.endswith("\\") else folder + "/*"
270
+ if specific_file_filter:
271
+ folder = folder + f"/*{specific_file_filter}*"
272
+ else:
273
+ folder = folder + "/*"
263
274
 
264
275
  fstat_output = self.run_cmd("fstat", file_list=[folder])
265
276
  p4files = self.fstat_to_p4_files(fstat_output, allow_invalid_files=allow_invalid_files)
@@ -269,13 +280,13 @@ class P4Client(object):
269
280
  if include_subfolders:
270
281
  all_files = []
271
282
  for root, dirs, files in os.walk(folder):
272
- for file_name in files:
283
+ for file_name in [f for f in files if specific_file_filter in f]:
273
284
  complete_file_path = os.path.join(root, file_name)
274
- if not complete_file_path in files:
285
+ if not complete_file_path in all_files:
275
286
  all_files.append(complete_file_path)
276
287
  else:
277
288
  all_files = [os.path.join(folder, file) for file in os.listdir(folder) if
278
- os.path.isfile(os.path.join(folder, file))]
289
+ os.path.isfile(os.path.join(folder, file)) and specific_file_filter in file]
279
290
 
280
291
  return self.files_to_p4files(all_files)
281
292
 
@@ -582,11 +593,14 @@ class P4Client(object):
582
593
  return info_dicts
583
594
 
584
595
  @validate_not_empty
585
- def reconcile_offline_files(self, file_list, changelist="default"):
596
+ def reconcile_offline_files(self, file_list, add=True, edit=True, delete=True, changelist="default"):
586
597
  """
587
598
  Adds, opens for edit or delete any files that were changed outside Perforce
588
599
 
589
600
  :param file_list: *list* of local files
601
+ :param add: *bool* if True, adds new files
602
+ :param edit: *bool* if True, opens modified files for edit
603
+ :param delete: *bool* if True, marks deleted files for delete
590
604
  :param changelist: string or int value
591
605
  :return: *list* of info dicts
592
606
  """
@@ -594,15 +608,37 @@ class P4Client(object):
594
608
 
595
609
  changelist = self.__ensure_changelist(changelist)
596
610
 
597
- info_dicts = self.run_cmd("reconcile", args=["-c", changelist], file_list=file_list)
611
+ # Build args based on which operations are enabled
612
+ args = ["-c", changelist]
613
+
614
+ # Add flags for specific operations
615
+ if not add and not edit and not delete:
616
+ # If nothing is enabled, don't do anything
617
+ return []
618
+ elif add and edit and delete:
619
+ # Default behavior - reconcile everything (no additional flags needed)
620
+ pass
621
+ else:
622
+ # Specific operations requested
623
+ if add:
624
+ args.append("-a")
625
+ if edit:
626
+ args.append("-e")
627
+ if delete:
628
+ args.append("-d")
629
+
630
+ info_dicts = self.run_cmd("reconcile", args=args, file_list=file_list)
598
631
  return info_dicts
599
632
 
600
633
  @validate_not_empty
601
- def reconcile_offline_folders(self, folder_list, changelist="default"):
634
+ def reconcile_offline_folders(self, folder_list, add=True, edit=True, delete=True, changelist="default"):
602
635
  """
603
636
  Adds, opens for edit or delete any files in the rootfolder + subfolders that were changed outside Perforce
604
637
 
605
638
  :param folder_list: *list* folders
639
+ :param add: *bool* if True, adds new files
640
+ :param edit: *bool* if True, opens modified files for edit
641
+ :param delete: *bool* if True, marks deleted files for delete
606
642
  :param changelist: string or int value
607
643
  :return: *list* of info dicts
608
644
  """
@@ -619,7 +655,26 @@ class P4Client(object):
619
655
 
620
656
  changelist = self.__ensure_changelist(changelist)
621
657
 
622
- info_dicts = self.run_cmd("reconcile", args=["-c", changelist], file_list=cleaned_folder_list)
658
+ # Build args based on which operations are enabled
659
+ args = ["-c", changelist]
660
+
661
+ # Add flags for specific operations
662
+ if not add and not edit and not delete:
663
+ # If nothing is enabled, don't do anything
664
+ return []
665
+ elif add and edit and delete:
666
+ # Default behavior - reconcile everything (no additional flags needed)
667
+ pass
668
+ else:
669
+ # Specific operations requested
670
+ if add:
671
+ args.append("-a")
672
+ if edit:
673
+ args.append("-e")
674
+ if delete:
675
+ args.append("-d")
676
+
677
+ info_dicts = self.run_cmd("reconcile", args=args, file_list=cleaned_folder_list)
623
678
  return info_dicts
624
679
 
625
680
  @validate_not_empty
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: p4cmd
3
- Version: 2.8.2
3
+ Version: 2.8.5
4
4
  Summary: Simple P4 python module
5
5
  Home-page: https://github.com/nielsvaes/p4cmd
6
6
  Author: Niels Vaes
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