Locked OmegaT Team Project (SVN)

Situation

One of the translators involved in a team translation project using a very cool OmegaT Team project feature gets a message about the project being locked.

16

Problem

The translator’s connectivity is rather limited and re-downloading the whole project would be very undesirable. There’s also no SVN software installed on her computer (other than OmegaT itself). Otherwise the quickest solution would be either getting OmegaT to download the project anew into an empty folder, or run “svn cleanup” on the project’s folder using one of the available SVN tools. Bad luck this time.

Solution

Since OmegaT can act as a SVN client itself (that’s what it does when a Team project is loaded), and there’s a cool scripting functionality, why not just exploit OmegaT to do the cleanup on any folder of our choice? So, here’s the script (the heading is also a link):

  • svn_cleanup_selected.groovy

    /*
     * Perform SVN cleanup on any local SVN repository
     *
     * @author	Yu Tang
     * @author	Kos Ivatsov
     * @date	2014-01-17
     * @version	0.2
     */
    
    import javax.swing.JFileChooser
    import org.omegat.core.team.SVNRemoteRepository
    import org.tmatesoft.svn.core.wc.*
    
    def folder
    
    if (project.isProjectLoaded()) {
    	def prop = project.getProjectProperties()
    	folder = new File(prop.getProjectRoot())
    	}else{
    	JFileChooser fc = new JFileChooser(
    		dialogTitle: "Choose SVN repository to perform cleanup",
    		fileSelectionMode: JFileChooser.DIRECTORIES_ONLY, 
    		multiSelectionEnabled: false
    		)
    	if(fc.showOpenDialog() != JFileChooser.APPROVE_OPTION) {
    		console.println "Canceled"
    		return
    		}
    	folder = new File(fc.getSelectedFile().toString())
    	}
    
    if (SVNRemoteRepository.isSVNDirectory(folder)) { 
    	def clientManager = SVNClientManager.newInstance()
    	clientManager.getWCClient().doCleanup(folder)
    	console.println("Cleanup done!!")
    	}
    return
    

    If that pesky message pops up, it should usually suffice to fire up the script (it works even if no project is currently loaded, otherwise it cleans up the current project if it happens to be a Team project), browse to the problematic project folder and get “Cleanup done!!” message in the Scripting console. After that, the project should open without problems.

    After the fix there might be a problem with sync, and OmegaT may throw a message like this:

    sync problem

    but that is usually easily fixed with Ctrl+S (Save) or F5 (Reload).

I wish you all good and stable Internet connection, responsive and responsible team members and a glitch-less work-flow.

But as of now,

Good luck

UPDATE:

The script is now bundled with OmegaT, you’ll get it along with the program. No need to download it from the links posted here.

SVN status

Here’s a little script that checks current SVN status of various files in an OmegaT team project. May not be awfully useful, but sometimes it can help you prevent or solve SVN sync issues. It doesn’t do anything special, just shows you the status of the project’s project_save.tmx, main writable glossary, current file and the whole project folder. Continue reading

OmegaT SVN cleanup

Situation

So, you’ve been using OmegaT’s Team Project feature for a while, and recently you’ve noticed that the folder named .svn (which is hidden, and therefore you noticed it rather accidentally) is immensely big compared to all the other files in the project, and keeps growing.

Problem

Taking up space may not be a problem in the short run, but if it’s a longterm project with source files being added and removed to and from the SVN, in a couple weeks this .svn folder can grow uncomfortably big. Deleting .svn folder or its content stops the project from being a team project.

Continue reading