Please clarify where documentation lacks for merge cmdline

If you are having a problem using SourceOffSite, post a message here.

Moderator: SourceGear

Post Reply
chrismon
Posts: 4
Joined: Tue Jan 17, 2006 3:25 pm

Please clarify where documentation lacks for merge cmdline

Post by chrismon » Wed Mar 15, 2006 10:34 am

I've look at these docs and in the KB with marginal success:

http://download.sourcegear.com/misc/sos/help/merge.htm
http://download.sourcegear.com/misc/sos ... grams1.htm

The documents for using external programs explains that the arguments to the user-supplied command are various numbers of "%s" strings. There's no explaination as to what these are supposed to represent or what they do.

When I set up the diff command to use

program "%s" "%s"

and use a wrapper script to show me what SOS is really putting on the command line, I get filenames of my source in the tree and what I suppose is a temp copy of whats in VSS. Is this correct?

When I set up the merge command to use

program "%s" %s"

the command output that my wrapper script shows is like this:

program %s %s my_source_from_tree older_tmp_file newer_tmp_file

When I put the only the program name into the configuration, not specifying "%s", I just get those three files and the merging program I use (meld) shows all three. I suppose that's OK, but now I'm not clear on what is trying to merge into what, what will get written to where, and so on. And...

My source file from my local tree is not writable when the merge process begins and so if I try to merge into it from the tmp copies from VSS it refuses to write. I could circumvent this by having my wrapper script unlock the file before the merge and then re-lock it afterwards, but this seems like something SOS should be handling and so I am wondering if I am doing something else wrong.

If the docs had a "newb" explanation of merging concepts an how SOS in particular expects it to be handled that'd be great. Shedding any light on this would be much appreciated, thanks.

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Post by lbauer » Thu Mar 16, 2006 10:13 am

The diff program for Unix must contain 2 "%s" symbols in the string that is entered - these 2 "%s" symbols get replaced by the 2 file names. The
"viewer or editor" is configured in the same way, but with a single "%s"
symbol.

For example, here's how you would configure "diff" as your diff utility. Note the use of quotes around the "%s" symbols in case your files or projects contain spaces in the filename):

diff "%s" "%s" > /tmp/sosdifffile; xterm -e view /tmp/sosdifffile; rm
/tmp/sosdifffile

What this does is it runs the "diff" program with the 2 files as the arguments, redirects the output of "diff" to a file '/tmp/sosdifffile', then runs the program "view" which is a read-only viewer on Unix to view the file, then it deletes the 'tmp' file after you are done viewing it.

If you have your own graphical differ or viewer/editor, you can specify the diff utility as:

For the diff utility:
<program name> "%s" "%s"

For the View/Edit utiliy:
<program name> "%s"

So, in essence, whatever string you use for the diff program must contain
2 occurrences of the chars "%s" which will be replaced by the 2 file names that are being diffed. Whatever program you use for viewing and editing must contain 1 occurrence of the chars "%s".

I hope this information is of help.
Linda Bauer
SourceGear
Technical Support Manager

Post Reply