Created
March 14, 2012 09:07
-
-
Save flohdot/2035258 to your computer and use it in GitHub Desktop.
Remote SVN commit macro for Komodo Edit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Komodo macro for committing/adding/deleting all changes on a certain path on a remote server. | |
* Requires an SSH/SFTP connection to the server. | |
* | |
* Please be aware that *everything* in the containing folder is committed! All new files will be added and missing files will be deleted. | |
* | |
* Don't forget to replace PATH_TO_COMMIT with your own value! | |
* | |
* based on this thread: http://community.activestate.com/forum-topic/there-way-execute-command-remote-server-ssh | |
**/ | |
function getRemoteSSHConnection() { | |
var remoteConnectionSvc = Components.classes["@activestate.com/koRemoteConnectionService;1"]. | |
getService(Components.interfaces.koIRemoteConnectionService); | |
// Use the current file's URI. | |
var view = ko.views.manager.currentView; | |
var uri = view.document && view.document.file.URI || view.koDoc.file.URI; // Support K7 koDoc | |
if (uri.substr(0, 1) != "s") { | |
throw Error("The current file is not a remote SSH file. Open a remote file first."); | |
} | |
var conn = remoteConnectionSvc.getConnectionUsingUri(uri); | |
if (conn) { | |
// Ensure it's an SSH connection | |
conn.QueryInterface(Components.interfaces.koISSHConnection); | |
} | |
return conn | |
} | |
function callCommand(c) { | |
var retval = conn.runCommand("cd "+path+"; "+c, false, stdout, stderr); | |
if (retval == 0) { | |
if(stdout.value) { | |
alert("Success!\n"+stdout.value); | |
} | |
} else { | |
alert("Error"); | |
} | |
} | |
var conn = getRemoteSSHConnection(); | |
var stdout = {}; | |
var stderr = {}; | |
var message = prompt("Please enter a commit comment (ie. brief description of what you changed):"); | |
var path = PATH_TO_COMMIT; | |
callCommand("svn status | grep '^\!' | sed 's/! *//' | xargs -I% svn rm %"); | |
callCommand("svn add --force *"); | |
callCommand("svn commit * -m \""+message+"\""); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment