Skip to content

Commit 9d134ac

Browse files
committed
processFilelog: improve compatibility with encoding=="raw"
`p4 filelog` may truncate changelist descriptions in multibyte encodings. Setting p4.encoding = "raw" appears to be an effective workaround, but p4.run_filelog() breaks under raw encoding, because processFilelog() assumes the revision object contains strs. This is simple enough to fix. Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
1 parent eeaa129 commit 9d134ac

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

P4.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,17 +370,20 @@ def processFilelog(h):
370370
if (not "how" in h) or (n >= len(h["how"]) or h["how"][n] == None):
371371
continue
372372
else:
373+
number_sign = '#'
374+
if type(h["depotFile"]) == bytes:
375+
number_sign = b'#'
373376
for m, how in enumerate( h[ "how" ][ n ] ):
374377
file = h[ "file" ][ n ][ m ]
375-
srev = h[ "srev" ][ n ][ m ].lstrip('#')
376-
erev = h[ "erev" ][ n ][ m ].lstrip('#')
378+
srev = h[ "srev" ][ n ][ m ].lstrip(number_sign)
379+
erev = h[ "erev" ][ n ][ m ].lstrip(number_sign)
377380

378-
if srev == "none":
381+
if srev == "none" or srev == b"none":
379382
srev = 0
380383
else:
381384
srev = int( srev )
382385

383-
if erev == "none":
386+
if erev == "none" or erev == b"none":
384387
erev = 0
385388
else:
386389
erev = int( erev )

0 commit comments

Comments
 (0)