sobota, 12 marca 2011

Use svn-clean safely

That is, suppose you have some useful stuff in your project sources "root" directory, e.g. it looks like that:

frontend

backend

api

.metadata

some-makeshift-file-with-useful-content-you-do-not-want-to-be-removed

Now you want to use svn-clean script, which is a part of subversion-tools Debian package (see e.g. http://packages.debian.org/search?keywords=subversion-tools). If you invoke it like that:

svn-clean .

you'll lose your eclipse workspace and that useful file with a lenghty name. So:

find -maxdepth 1 -mindepth 1 -type d -name "[a-zA-Z]*" -exec svn-clean {} \;

piątek, 11 marca 2011

How to resolve Subversion merge conflicts using kdiff3

export SVN_MERGE=/path/to/the/script/below/mergewrap.sh

#!/bin/sh

# mergewrap.sh

kdiff3 $1 $2 $3 -o $4

Now let's merge something and wait until SVN client detects a conflict and asks you what to do - then choose "l" for "launch external tool to resolve conflict":

svn merge -c17218 ^/src/trunk

--- Merging r17218 into 'backend':

U backend/src/main/resources/default.properties

Conflict discovered in 'backend/pom.xml'.

Select: (p) postpone, (df) diff-full, (e) edit,

(mc) mine-conflict, (tc) theirs-conflict,

(s) show all options: l

When you are done with the merge, have saved the file and closed kdiff3, you are asked the same question again. Now you can answer "r" for "accept merged version of file". That's it.

They say you can also set merge-tool-cmd configuration property, but somehow it did not work for me. SVN_MERGE did.