revert.script #1

  • //
  • guest/
  • axel_wienberg/
  • sitepadp4/
  • files/
  • Tools/
  • Perforce/
  • revert.script
  • View
  • Commits
  • Open Download .zip Download (926 B)
!!Script
// revert the current file to the version last synced from the depot.
// runs p4 revert <filename>
//
// (c) 2000 Software System Group, TU Harburg
//     Axel Wienberg, ax.wienberg@tu-harburg.de
//
// based on CSRCS binding by joe robertson, jmrobert@ro.com
//
var perfdir = File.getApplicationPath() + "\\Tools\\Perforce";

function DoCommand()
{
	output = getOutput()
	var editor = getActiveEditor();
	var thisfile = editor.getFile();
	// common function moved to utilities
	var util = getScriptObject(perfdir + "\\utilities.script");
  var p4exe = util.getP4ExePath();
	if (p4exe == null){
		output.writeLine("P4 executable not found.");
	} 
	else {	
		//set command line 
		var program = p4exe + " revert ";
		var commandLine = program + thisfile.path;
		//run it
		var tool = newTool();
	  tool.showCommandWindow = false;
	  tool.async = false;
	  tool.run(commandLine);
		editor.reload(true);
	}
}

!!/Script

# Change User Description Committed
#1 1014 axel_wienberg copied perforte and sitepadp4 files from my homepage to the public depot.
happy branching and improving :-)