p4cmd 2.6.0__tar.gz → 2.7.0__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.6.0 → p4cmd-2.7.0}/PKG-INFO +1 -1
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd/__init__.py +1 -1
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd/p4cmd.py +66 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd.egg-info/PKG-INFO +1 -1
- {p4cmd-2.6.0 → p4cmd-2.7.0}/LICENSE +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/README.md +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd/p4errors.py +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd/p4file.py +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd/resources/__init__.py +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd/resources/perforce_DEPOT_ONLY.png +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd/resources/perforce_MOVED.png +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd/resources/perforce_NEED_SYNC.png +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd/resources/perforce_OPEN_FOR_ADD.png +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd/resources/perforce_OPEN_FOR_DELETE.png +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd/resources/perforce_OPEN_FOR_EDIT.png +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd/resources/perforce_UNKNOWN.png +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd/resources/perforce_UNTRACKED.png +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd/resources/perforce_UP_TO_DATE.png +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd/utils.py +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd.egg-info/SOURCES.txt +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd.egg-info/dependency_links.txt +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/p4cmd.egg-info/top_level.txt +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/setup.cfg +0 -0
- {p4cmd-2.6.0 → p4cmd-2.7.0}/setup.py +0 -0
|
@@ -306,7 +306,73 @@ class P4Client(object):
|
|
|
306
306
|
if len(changelists):
|
|
307
307
|
return True
|
|
308
308
|
return False
|
|
309
|
+
|
|
310
|
+
def update_changelist_description(self, changelist, new_description):
|
|
311
|
+
"""
|
|
312
|
+
Updates the description of an existing changelist.
|
|
309
313
|
|
|
314
|
+
:param changelist: *string* or *int* changelist number
|
|
315
|
+
:param new_description: *string* new description for the changelist
|
|
316
|
+
:return: *bool* True if successful, False otherwise
|
|
317
|
+
"""
|
|
318
|
+
|
|
319
|
+
# ... not super elegant, but it works
|
|
320
|
+
try:
|
|
321
|
+
changelist = self.__ensure_changelist(changelist)
|
|
322
|
+
|
|
323
|
+
# do some formatting so that we have the proper indentation
|
|
324
|
+
formatted_description = []
|
|
325
|
+
for line in new_description.split('\n'):
|
|
326
|
+
formatted_description.append(f"\t{line}")
|
|
327
|
+
formatted_description = '\n'.join(formatted_description)
|
|
328
|
+
|
|
329
|
+
output = subprocess.check_output(f'p4 change -o {changelist}', shell=True).decode()
|
|
330
|
+
|
|
331
|
+
# Split the output into sections based on field names
|
|
332
|
+
sections = []
|
|
333
|
+
current_section = []
|
|
334
|
+
current_field = None
|
|
335
|
+
|
|
336
|
+
# take the output and start parsing it
|
|
337
|
+
for line in output.split('\n'):
|
|
338
|
+
# check if it's a new field
|
|
339
|
+
if line.strip() and ':' in line and not line.startswith('\t'):
|
|
340
|
+
# if it is, save the previous section
|
|
341
|
+
if current_field:
|
|
342
|
+
sections.append((current_field, current_section))
|
|
343
|
+
# now start a new section
|
|
344
|
+
current_field = line.split(':', 1)[0].strip()
|
|
345
|
+
current_section = [line]
|
|
346
|
+
else:
|
|
347
|
+
# if it's not a new field, add to the current section
|
|
348
|
+
current_section.append(line)
|
|
349
|
+
|
|
350
|
+
# add the last section
|
|
351
|
+
if current_field:
|
|
352
|
+
sections.append((current_field, current_section))
|
|
353
|
+
|
|
354
|
+
# new remake the Description field with the update description
|
|
355
|
+
new_output = []
|
|
356
|
+
for field, section_lines in sections:
|
|
357
|
+
if field == "Description":
|
|
358
|
+
# replace the description section
|
|
359
|
+
new_output.append(section_lines[0]) # keep the "Description:" line because perforce needs this
|
|
360
|
+
new_output.append(formatted_description)
|
|
361
|
+
else:
|
|
362
|
+
# keep everything else as-is
|
|
363
|
+
new_output.extend(section_lines)
|
|
364
|
+
|
|
365
|
+
updated_output = '\n'.join(new_output)
|
|
366
|
+
|
|
367
|
+
# TODO: modify run_cmd to allow input so that commands like this can also run through it.
|
|
368
|
+
result = subprocess.check_output(f'p4 change -i', input=updated_output.encode(), shell=True).decode()
|
|
369
|
+
|
|
370
|
+
return True
|
|
371
|
+
except Exception as e:
|
|
372
|
+
if not self.silent:
|
|
373
|
+
logging.error(f"Failed to update changelist description: {e}")
|
|
374
|
+
return False
|
|
375
|
+
|
|
310
376
|
@validate_not_empty
|
|
311
377
|
def move_files_to_changelist(self, file_list, changelist="default"):
|
|
312
378
|
"""
|
|
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
|