Peter Stone
Peter Stone

Reputation: 3776

Subversion: Fail update when there are conflicts?

Is there a way to tell subversion "update/merge unless it would cause a conflict"?

I know you can use --dry-run / status -u to check before running the update, but I often have others running updates and getting broken webpages because they don't notice the "C index.php" line.

I've also noticed that svn doesn't seem too unhappy about conflicts - it still says "updated to revision blah" and exits zero, regardless of conflicts. So I have to parse the line-by-line output to discover them. Surely there's a better way?

Upvotes: 4

Views: 1635

Answers (6)

jackr
jackr

Reputation: 1437

Subversion 1.5 (recently released) adds some ability to specify what happens during an update conflict, with the "--accept" argument.

Upvotes: 0

Sander Rijken
Sander Rijken

Reputation: 21615

You can use the --accept parameter to indicate what should happen when a conflict occurs:

--accept ARG             : specify automatic conflict resolution action
                          ('postpone', 'base', 'mine-full', 'theirs-full',
                          'edit', 'launch')

See also the interactive conflict resolution page in the svnbook

Upvotes: 3

Jean
Jean

Reputation: 21595

you could also use a pre-commit script to look for conflict markers in files and prevent commit when they are present.

Upvotes: 0

Damien B
Damien B

Reputation: 2003

You could use the --diff3-cmd parameter to specify which merging tool to use (usually diff3 from diffutils).

Upvotes: 1

Peter Stone
Peter Stone

Reputation: 3776

@jsight: TortoiseSVN is great, but I primarily develop in a *NIX environment, without X. So I'm usually using (restricted to) the command line.

In re your script suggestion, that's what I'm working on now - which is why I'm annoyed that I can't just check $?. Right now I'm skipping the "output to a file" and using a pipe, but otherwise exactly what you describe.

Upvotes: 1

jsight
jsight

Reputation: 28409

Perhaps a better way is to use a graphical tool? Or write a script to do the update that redirects the output to a file and does a "cat svnupdate.log | grep "^C "" at the end to show you any conflicts?

With the graphical tools that I use (TortoiseSVN and Netbeans), they make a nasty noise at the end and present you with a merge selection dialog for dealing with them. I don't know of an equivalent with as much power for the command line tools.

Upvotes: 1

Related Questions