• 
      

    Skip files where 'p4 print' provides a symlink

    Review Request #3221 — Created July 16, 2012 and submitted — Latest diff uploaded

    Information

    RBTools

    Reviewers

    The riddle: how can a file both exist and not exist? The answer: symlinks!
    When a symlink is checked into perforce running 'p4 print -o' will create a
    symlink, not the file that it points to. This naturally makes postreview.py
    choke...
    
    ~% post-review
    Traceback (most recent call last):
      File "/share/rbtools/rbtools/postreview.py", line 4115, in <module>
        main()  
      File "/share/rbtools/rbtools/postreview.py", line 4061, in main 
        diff, parent_diff = tool.diff(args)
      File "/share/rbtools/rbtools/postreview.py", line 2002, in diff 
        return self._changenum_diff(changenum)
      File "/share/rbtools/rbtools/postreview.py", line 2299, in _changenum_diff
        self._write_file(old_depot_path, tmp_diff_from_filename)
      File "/share/rbtools/rbtools/postreview.py", line 2475, in _write_file
        os.chmod(tmpfile, stat.S_IREAD | stat.S_IWRITE)
    OSError: [Errno 2] No such file or directory: '/tmp/tmpsCS-fw'
    
    Resolving symlinks, especially those with a relative path would be tricky. 
    Also, there's no certainty that the file it points to is even in version 
    control. Hence I'm just dropping it from the review with a warning.
    
    Tested this change both when reviewing a single symlink file and a batch of
    files containing a symlink.
    
    We've been using this change against RBTools 0.3. I've adapted the change for
    the current master but this copy of it hasn't been exercised.