TortoiseSVN: Commit multiple selected files from lister with a button

I have a button that does a TortoiseSVN commit of selected files. Unfortunately, if I have multiple files select, it opens a commit window for each one. What I want is for it to pass all of the selected files in a single commit operation, opening just one commit box. My button does this:

@NODESELECT "C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:commit /path:"{sourcepath$}{file}" /closeonend:3
I surely picked it up here on the forum, but I don't know from what discussion thread. (I usually save the source URLs for things like this, but I failed to in this case.)

The TortoiseSVN documentation says to put an asterisk ('*') between each filespec after its /path argument:


After I get this working, I'd want to do the same with my TortoiseSVN Update button, which contains this:

@NODESELECT "C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:update /path:"{sourcepath$}{file}" /closeonend:0
And my TortoiseSVN Check for Modifications button, which contains this:

@NODESELECT "C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:repostatus /path:"{sourcepath$}{file}"

Looks like it may have been from this post:

Also, look at the "sep=" option on this help page: ... enames.htm

But, I think things are complicated by the fact that the command you're using has both sourcepath and file specified separately. (Not sure why they're separate.) To fix that issue, look at the {allfilepath} argument on the same Help page.

If I understand correctly, this:

"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:commit /path:"{sourcepath$}{file}" /closeonend:3

would become this:

"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:commit /path:"{allfilepath|sep=*}" /closeonend:3

Thanks, Ric. That doesn't work. But perhaps we're on the right track. Maybe we'll hear from Leo, or a user who has done something like this before.

Solved it. I found this thread: [url]Question about {allfilepath|sep=,}]

So I changed your line from

"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:commit /path:"{allfilepath|sep=*}" /closeonend:3

@set paths {allfilepath|sep=*} "C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:commit /path:"{$paths}" /closeonend:3
And that worked!

Thanks, Ric.

Try using /pathfile:"{allfilepath|filem|ucsle|nobom}" like so:

"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:commit /pathfile:"{allfilepath|filem|ucsle|nobom}" /closeonend:3

That will also avoid problems due to command line length limits when lots of files are selected, as the list of files goes into a text file which is passed to TortoiseProc.exe.

Thanks, Leo. I'll definitely make your change so the thing will scale to huge file lists.

I noticed what I already used has an additional problem, which explains why the path and file name were split before (by whomever I borrowed the original solution from). That way if there were no files selected, the directory would still be defined and the single TortoiseSVN command would still get a path passed to it so it could run on the whole directory, not just supported files.

I might need to change my button to express: If files are selected, do x; if no files are selected, do y. I'll have to check into how to do this in Dopus.

For that last thing (making commands in a button conditional based upon whether any files are selected or not), I created this discussion: [url]Conditional commands inside button: Run different commands depending on whether files are selected]

Leo, your offered solution doesn't work for me. If I have one or more files selected when I push that command's button, a TortoiseSVN Commit box appears but it is missing both repository URL and working copy path.

It turns out TortoiseProc.exe has a requirement of only LF (line feed) characters between each line, while Opus outputs CR,LF pairs (as is standard on Windows). I didn't pick up on this because the Tortoise documentation just says "new lines", which implies CR,LF pairs to me in the context of a Windows app, and the command appears to work as far as showing the list of files has reached it, unless you go past the pre-commit dialog to an actual commit.

At the moment, you'd need to use a custom script to output the list of files in the correct format for using this method.

However, we've written a code change for the next update that will allow Opus to do it, adding new CROnly and LFOnly options to the existing output flags. So this command will work once 12.3.3 is out (probably after Christmas now):

"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:commit /pathfile:"{allfilepath|filem|ucsle|nobom|lfonly}" /closeonend:3

Thank you, Leo. Merry Christmas.