#! /usr/bin/env python """ Slightly messy script to quickly find symlinks used if we are having issues with pulling conversions accross """ import P4 from P4 import P4Exception def find_symlinks(p4): files = p4.run_files("//...") ignores = set([]) for file in files: flog = p4.run_filelog(file['depotFile']).pop() ignore = None for rev in flog.each_revision(): if rev.type == "symlink": try: print(p4.run_retype('-t', 'binary', file['depotFile']+'#'+file['rev'])) except P4Exception as p4exp: pass except Exception as exp: import ipdb; ipdb.set_trace() if not ignore: ignore = file['depotFile'] ignores.add(file['depotFile']) return ignores if __name__ == '__main__': p4 = P4.P4() p4.port = "CHANGEME:11666" p4.user = "perforce" p4.connect() ignores = find_symlinks(p4) with open('ignore.list.sym', 'w') as ils: for ignore in ignores: ils.write(ignore+'\n')