Jump to content

Format XML before checkin and compare and merge


StevenTCramer@gmail.com

Recommended Posts

So I have a tool that saves project files as XML but they store it as one long string.  I want to run XMLTidy on the files before putting them in the repo.  Also if I do a diff or a merge on a file I would like them formated as well.

 

I set my diff tool to External for files of type *.gfa with the following:

TidyGfa.bat @sourcefile @destinationfile

Where TidyGfa is:

 

tidy -i -m -xml %1
tidy -i -m -xml %2
mergetool -s="%1" -d="%2"

I also did it in powershell which seemed a lot more trouble:

 

But this only formats when doing a diff.  A merge is more complicated and a trigger also.

 

Has anyone done something similar?

 

 

 
Link to comment
Share on other sites

Hi Steven,

 

I'm not sure if you are having an error or why it's not working.

 

You should also create a custom merge tool, it can be a simple batch file that uses the tidy tool first and then:

 

mergetool.exe -s=%source% -b=%base% -d=%destination% -r=%result%

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...