p4cmd 2.8.4__tar.gz → 2.8.6__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.
- {p4cmd-2.8.4 → p4cmd-2.8.6}/PKG-INFO +1 -1
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd/__init__.py +1 -1
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd/p4cmd.py +20 -8
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd/p4file.py +14 -1
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd.egg-info/PKG-INFO +1 -1
- {p4cmd-2.8.4 → p4cmd-2.8.6}/LICENSE +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/README.md +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd/p4errors.py +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd/resources/__init__.py +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd/resources/perforce_DEPOT_ONLY.png +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd/resources/perforce_MOVED.png +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd/resources/perforce_NEED_SYNC.png +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd/resources/perforce_OPEN_FOR_ADD.png +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd/resources/perforce_OPEN_FOR_DELETE.png +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd/resources/perforce_OPEN_FOR_EDIT.png +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd/resources/perforce_UNKNOWN.png +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd/resources/perforce_UNTRACKED.png +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd/resources/perforce_UP_TO_DATE.png +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd/utils.py +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd.egg-info/SOURCES.txt +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd.egg-info/dependency_links.txt +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/p4cmd.egg-info/top_level.txt +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/setup.cfg +0 -0
- {p4cmd-2.8.4 → p4cmd-2.8.6}/setup.py +0 -0
|
@@ -229,7 +229,7 @@ class P4Client(object):
|
|
|
229
229
|
file_list = convert_to_list(file_list) if not isinstance(file_list, list) else file_list
|
|
230
230
|
|
|
231
231
|
if self.host_online():
|
|
232
|
-
fstat_output = self.run_cmd("fstat", file_list=file_list)
|
|
232
|
+
fstat_output = self.run_cmd("fstat", args=["-Ol"], file_list=file_list)
|
|
233
233
|
p4files = self.fstat_to_p4_files(fstat_output, allow_invalid_files=allow_invalid_files)
|
|
234
234
|
return p4files
|
|
235
235
|
else:
|
|
@@ -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,16 +252,27 @@ 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
|
-
|
|
265
|
+
if specific_file_filter:
|
|
266
|
+
folder = folder + f"/.../*{specific_file_filter}*"
|
|
267
|
+
else:
|
|
268
|
+
folder = folder + "/..."
|
|
261
269
|
else:
|
|
262
|
-
|
|
270
|
+
if specific_file_filter:
|
|
271
|
+
folder = folder + f"/*{specific_file_filter}*"
|
|
272
|
+
else:
|
|
273
|
+
folder = folder + "/*"
|
|
263
274
|
|
|
264
|
-
fstat_output = self.run_cmd("fstat", file_list=[folder])
|
|
275
|
+
fstat_output = self.run_cmd("fstat", args=["-Ol"], file_list=[folder])
|
|
265
276
|
p4files = self.fstat_to_p4_files(fstat_output, allow_invalid_files=allow_invalid_files)
|
|
266
277
|
return p4files
|
|
267
278
|
|
|
@@ -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
|
|
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
|
|
|
@@ -1276,6 +1287,7 @@ class P4Client(object):
|
|
|
1276
1287
|
p4file.set_action(self.__get_dict_value(file_dict, "action"))
|
|
1277
1288
|
p4file.set_head_action(self.__get_dict_value(file_dict, "headAction"))
|
|
1278
1289
|
p4file.set_raw_data(str(file_dict))
|
|
1290
|
+
p4file.set_file_size(self.__get_dict_value(file_dict, "fileSize"))
|
|
1279
1291
|
|
|
1280
1292
|
opened_by = []
|
|
1281
1293
|
for key, value in file_dict.items():
|
|
@@ -28,6 +28,7 @@ class P4File(object):
|
|
|
28
28
|
self.__action = None
|
|
29
29
|
self.__raw_data = None
|
|
30
30
|
self.__head_action = None
|
|
31
|
+
self.__file_size = None
|
|
31
32
|
|
|
32
33
|
def update_self(self, p4client):
|
|
33
34
|
if self.__depot_file_path is not None:
|
|
@@ -213,6 +214,17 @@ class P4File(object):
|
|
|
213
214
|
def set_last_submitted_by(self, value):
|
|
214
215
|
self.__last_submitted_by = value
|
|
215
216
|
|
|
217
|
+
def set_file_size(self, value):
|
|
218
|
+
self.__file_size = value
|
|
219
|
+
|
|
220
|
+
def get_file_size(self, in_megabyte=True):
|
|
221
|
+
try:
|
|
222
|
+
if in_megabyte:
|
|
223
|
+
return round(int(self.__file_size) / 1048576, 2)
|
|
224
|
+
return int(self.__file_size)
|
|
225
|
+
except:
|
|
226
|
+
return None
|
|
227
|
+
|
|
216
228
|
def __eq__(self, other):
|
|
217
229
|
if not isinstance(other, P4File):
|
|
218
230
|
return NotImplemented
|
|
@@ -220,7 +232,8 @@ class P4File(object):
|
|
|
220
232
|
private_attributes = [
|
|
221
233
|
'_P4File__local_file_path', '_P4File__depot_file_path', '_P4File__last_submitted_by',
|
|
222
234
|
'_P4File__have_revision', '_P4File__head_revision', '_P4File__checked_out_by',
|
|
223
|
-
'_P4File__last_submit_time', '_P4File__action', '_P4File__raw_data', '_P4File__head_action'
|
|
235
|
+
'_P4File__last_submit_time', '_P4File__action', '_P4File__raw_data', '_P4File__head_action',
|
|
236
|
+
'_P4File__file_size'
|
|
224
237
|
]
|
|
225
238
|
|
|
226
239
|
for attr in private_attributes:
|
|
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
|