pristine svn-base file missing

有些话、适合烂在心里 提交于 2019-12-09 05:14:05

问题


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 fails too stating that a \.svn\pristine\20\20long-namecbf.svn-base file cannot be found.

I've already tried to release the lock but this does not work either.

Any idea how should I proceed?


回答1:


You can use SmartSVN to restore lost pristine file.
Download and install it. It's not free but 30 days free trial should be enough to repair your repository.
Open your working copy in SmartSVN. To repair, select Modify > Validate Admin Area...
Enjoy!




回答2:


This problem:

cannot find the file .svn\pristine\24\24fd530d4bd82341fb514ab912c9e10adbc4ad89.svn-base

I copied a svn-base from other file and renamed this with 24fd530d4bd82341fb514ab912c9e10adbc4ad89.svn-base. And perform a clean up operation. After that I met another file missing. Using the same way, and at last I fixed this problem.

From a Windows command line with SilkSVN installed:

cd project directory
svn status

This will generate an error. Select and copy the directory and filename text then paste:

echo > .svn\pristine\<paste>

For example:

echo > 24\24fd530d4bd82341fb514ab912c9e10adbc4ad89.svn-base

With this knowledge in hand, it would be reasonably trivial to write a batch file that can fix these problems automatically for everyone. The svn command will generate an %ERRORLEVEL% value that can be checked for failure.




回答3:


I solved this by

  1. Creating an empty file /workingdirectory/.svn/pristine/da/da39a3ee5e6b4b0d3255bfef95601800afd80009.svn-base

  2. Run svn cleanup




回答4:


I got away by replacing the .svn directory with the same from a freshly checked-out copy. Fortunately for me, the local copy was on the same revision as the repo. Not sure what the implications would be if it was not the case.




回答5:


For me the file was there but had (1) appended to the name. (A copy) ff4c7be3da460bb91144d6761cc5743536c983f4 (1).svn-base

I removed the "(1)" and cleanup ran fine ff4c7be3da460bb91144d6761cc5743536c983f4.svn-base




回答6:


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


来源:https://stackoverflow.com/questions/12243793/pristine-svn-base-file-missing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!