Pregunta

¿Cómo puedo copiar la salida diff (diff old-version.cpp new-version.cpp) en un correo electrónico de Outlook para poder enviársela a otras personas con resaltado de sintaxis ?

Me gustaría canalizar la salida de diferencias a un programa que la copiará al portapapeles con formato (p4 diff file.cpp | rtfpatch) o tener un complemento para Outlook que me permita seleccionar texto, hacer clic en un botón y se coloreará .

Utilizo Windows (XP y Vista), Perforce, Visual Studio, Beyond Compare 3, Outlook 2007. Cualquier cosa que use una combinación de esas herramientas funcionaría muy bien (no estoy buscando cambiar mi programa principal de diferencias, etc.) .).

¿Fue útil?

Solución

Puede usar " Informe de comparación de texto " de Beyond Compare; comando en el menú Sesión para hacer esto. Utilice & Quot; Interleaved & Quot; estilo de diseño, el " Informe HTML " estilo de salida y " Copiar al portapapeles " comando y lo copiará al portapapeles como HTML coloreado. No tengo Outlook para probar, pero ciertamente funciona pegándolo en Word.

Otros consejos

Another decent solution I've found is a vim plugin. cliphtml.vim gives you the :ClipHtml ex command that will copy the whole file or the selected region to the clipboard with vim's highlighting.

Requires python.

Many editors have the ability to export syntax-highlighted files as HTML. From there, you can paste the HTML into Outlook. For example, to export a file to HTML in Vim, use :TOhtml.

This Visual Studio addon offers the "export to HTML" functionality as well. It's worth giving it a try.

To paste the html into into outlook you should try an past it into th source of the msg. Right click the body of the HTML message and the select View source, then past your html into that.

The other way would be to script it in a batch file using and set the Message html body to equal your html text and send. There are quite a few examples of sending email via script on stackoverflow. There are a number of ways to do it depending what you have installed etc. one example is
Send mail from a Windows script
using CDO

I figured out a solution to make a batch file that diffs files from Perforce using the p4diff.exe program.

The problem with it is p4diff outputs the whole file, not only the changed sections (I'd also prefer unified diff). Also, diffing specific revisions requires calling rtfdiff from command line (the custom tool just diffs against HEAD).

p4v custom tool definition (write this to tool.xml and then import it in p4v's Manage Custom Tools menu):

<CustomToolDef>
  <Definition>
    <Name>RTF Diff</Name>
    <Command>c:\scripts\rtfdiff.bat</Command>
    <Arguments>%f</Arguments>
  </Definition>
  <AddToContext>true</AddToContext>
</CustomToolDef>

where rtfdiff.bat is

:: Use p4diff to get copy-pasteable diff output.

:: setlocal so we use the default after script terminates
setlocal
set P4DIFF=c:\Perforce\p4diff.exe
:: Diff all inputs to allow multiple revisions (must be in increasing order)
p4 diff %*

That will let you right click on a file and select "RTF Diff" or call rtfdiff.bat via command line (rtfdiff.bat file.txt#1 file.txt#2).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top