Spenhouet
Spenhouet

Reputation: 7169

How to skip broken revision in svnsync sync

What I'm trying to do:

I'm in the middle of mirroring our remote svn repo to my local Win7. Therefor I'm following some steps of this tutorial.

The problem:

Now the svnsync sync file:///c:/repository (same step as in the tutorial) is stuck at revision 25824 of about 84000.

Committed revision 25823.
Copied properties for revision 25823.
svnsync: E160006: No such revision 25824

It should be just this one and only broken revision in the middle of the repo.

The question:

Is it possible to skip that revision, fake it or even just copy it broken?

It took a while until this revision so please no solutions where i have to start over from the beginning. Also i can't make changes to the remote svn repo.

Other stackoverflow threads like How to skip initial revisions in svnsync sync (to fix broken repository) didn't help me in that case.

Upvotes: 1

Views: 2268

Answers (2)

Spenhouet
Spenhouet

Reputation: 7169

Alot time pased and now i solved my problem.

I followed this tutorial: http://www.apharmony.com/software-sagacity/2014/07/recovering-from-a-missing-svn-revision/

The first dump has to be without the --incremental and --delta option. Load it to a new SVN server.

For the rest i wrote an VBS Skript.

call dumpRevs(0, 80000)

With dumpRevs i dump the old Repository to somewhere else (and log it). VBS started on old SVN Server.

call loadDump(newRepoPath, 0, 80000) 

With loadDump i load the dumped revs on to the new repo. Broken revisions get replaced with dummy commits. VBS started on new SVN Server

At the end there can be missing files in the new repo. Therefor i match them against each other. To do this, i check both repos out and transfer the diff to the new repo and made a final commit (don't forget the make a dummy commit on the same revision on you old repo so new checkins can still be dumped and loaded).

call updateRepos(https:\\oldSVNServer\oldRepo\projektA, projektA) 

I used updateRepos to check out my repos (big repository..).

My script should just be an idea of how to make that. Everything between [] must be set.

Function dumpRevs(revStart, revEnd)
    Set oShell = CreateObject("WSCript.shell")
    Dim rev, dumpCommand
    rev = revStart
    while rev <= revEnd
        dumpCommand = "cmd.exe /C svnadmin dump [old Repo Folder] -r " & rev & " --incremental --deltas > [dump Folder]" & rev
        oShell.run dumpCommand, 1, True
        rev = rev + 1
    wend
End Function

Function loadDump(repoPath, revStart, revEnd)
    Set oShell = CreateObject("WSCript.shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Dim rev, dumpCommand, dumpFilesPath, logPath, dummyRev
    dummyRev = "cmd.exe /C svnmucc propset dummy_prop 0 -m ""increases revision"" [new Repo URL] --username admin --password admin"
    rev = revStart
    while rev <= revEnd

        dumpFilesPath = "[dumpFolder]" & rev
        logPath = "[logFolder]" & rev & ".log"
        loadCommand = "cmd.exe /C svnadmin load " & repoPath &" < " & dumpFilesPath & " > " & logPath & " 2>&1"
        oShell.run loadCommand, 1, True

        If fileContains(logPath, "Committed revision "& rev & "") = false Then
            oShell.run dummyRev, 1, True
        End If
        rev = rev + 1
    wend
End Function

Function updateRepos(repoPath, name)
    Set oShell = CreateObject("WSCript.shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Dim logPath, uptodate, upCommand, cleanCommand, nr  
    uptodate = false
    nr = 1

    Do
        logPath = "C:\Temp\up_" & name & nr & ".log"
        upCommand = "cmd.exe /C svn up --username admin --password admin --non-interactive " & repoPath & " > " & logPath & " 2>&1"
        cleanCommand = "cmd.exe /C svn cleanup --username admin --password admin --non-interactive " & repoPath & " > " & logPath & " 2>&1 & ECHO cleanup >>" &     logPath
        oShell.run upCommand, 1, True

        If fileContains(logPath, "is already locked") =true Or fileIsEmpty(logPath) =true Then
            oShell.run cleanCommand, 1, True
        ElseIf (fileContains(logPath, "Request Entity Too Large") = true) Or (fileContains(logPath, "out of memory") = true) Or (fileContains(logPath, "Caught signal") = true) Or (fileContains(logPath, "At revision") = true) Or (fileContains(logPath, "The XML response contains invalid XML") = true) Then
            Exit Function
        End If
        nr = nr + 1
    Loop While fileContains(logPath, "Updated to revision") <> true 
End Function

Function fileContains(filePath, str)
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Dim tempStr
    Set objInputFile = objFSO.OpenTextFile(filePath, 1, False)  
    Do until objInputFile.AtEndOfStream
        tmpStr = objInputFile.ReadLine

        If InStr(tmpStr, str) > 0 Then
                fileContains = true
            Exit Function
        End If
    Loop
    fileContains = false
End Function

Function fileIsEmpty(filePath)
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Dim size
    Set ofile = objFSO.getfile(filePath)
    size = ofile.size
    If size < 30 Then
        fileIsEmpty = true
        Exit Function
    End If
    fileIsEmpty = false
End Function

Upvotes: 0

bahrep
bahrep

Reputation: 30662

You say that you can't make changes to the remote svn repo so you are quite limited in options. I guess that svnrdump tool can help you, though.

You can dump revisions 25825-HEAD remotely and load them to your local repo using svnadmin load.

  1. svnrdump dump <URL-TO-REPO> -r 25825:HEAD > MyDump.txt
  2. svnadmin load C:\respository < MyDump.txt

Upvotes: 2

Related Questions