[infra] Make git-sync-deps truncate directory from beginning
Instead of seeing something not super helpful like: /home/kjlubick/skia/skia/third_pa... @ 169895d529dfce00390a20e69c2f516066fe7a3b With this change, that becomes: ...rd_party/externals/d3d12allocator @ 169895d529dfce00390a20e69c2f516066fe7a3b Change-Id: Ie5483a5540f408719f797efdcb50d24b97b568fd Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471456 Reviewed-by: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
c1bbd1f190
commit
0566f5d93a
@ -100,11 +100,14 @@ def is_git_toplevel(git, directory):
|
||||
|
||||
|
||||
def status(directory, commithash, change):
|
||||
def truncate(s, length):
|
||||
def truncate_beginning(s, length):
|
||||
return s if len(s) <= length else '...' + s[-(length-3):]
|
||||
def truncate_end(s, length):
|
||||
return s if len(s) <= length else s[:(length - 3)] + '...'
|
||||
|
||||
dlen = 36
|
||||
directory = truncate(directory, dlen)
|
||||
commithash = truncate(commithash, 40)
|
||||
directory = truncate_beginning(directory, dlen)
|
||||
commithash = truncate_end(commithash, 40)
|
||||
symbol = '>' if change else '@'
|
||||
sys.stdout.write('%-*s %s %s\n' % (dlen, directory, symbol, commithash))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user