pristine svn-base file missing

前端 未结 7 1378
野趣味
野趣味 2021-02-07 00:43

I\'m trying to svn update my SVN working copy with TortoiseSVN but the update fails, asking to perform the clean up first.

However, the svn cleanup

相关标签:
7条回答
  • 2021-02-07 01:34

    Took chunguiw's answer and wrote a Python (2.7) script for it, in case anyone's interested.

    It follows the procedure: try a clean-up, parse output, touch missing file, repeat until done.

    import os
    import sys
    import subprocess
    import re
    
    def touch(fname, times=None):
        with open(fname, 'a'):
            os.utime(fname, times)
    
    
    svnbase_regex = re.compile(r"svn: E720002: Can't open file \'([^']+)\':")
    
    
    if __name__ == "__main__":
        # Can pass SVN working copy's root folder as a parameter, otherwise runs on CWD
        try:
            root_folder = sys.argv[1]
        except IndexError:
            root_folder = "."
        root_folder = os.path.abspath(root_folder)
        os.chdir(root_folder)
        count = max_times = 10
        # Repeats file touching at most N times (the number above)
        while count > 0:
            count -= 1
            try:
                svn_output = subprocess.check_output("svn cleanup", stderr=subprocess.STDOUT)
            except subprocess.CalledProcessError, e:
                svn_output = e.output
            regex_match = svnbase_regex.search(svn_output)
            if not regex_match:
                break
            touch(regex_match.group(1))
            print "Done %s" % regex_match.group(1)
        print "Exited, fixed up %s missing entries." % (max_times - count)
        print "last SVN output:"
        print svn_output
    
    0 讨论(0)
提交回复
热议问题