• gm_svn: SVN update from within GMod
    83 replies, posted
Figured I'd bump this since the fixed version may get lost within the WAYWO thread. Thanks to chrisaster for fixing it. [url]http://www.blackopsservers.com/blackops/files/gm_svn.zip[/url] The dll contains update, commit, cleanup, and checkout. [code] svn.update( dirpath, user, pass, torevision ) // Returns revision number svn.cleanup( dirpath ) // Returns a bool to determine if it was successful or not svn.checkout( url, dirpath, user, pass, torevision ) // Returns revision number svn.commit( dirpath, user, pass ) // Returns revision number. Was too lazy to get the update message working [/code] Some example code [lua]if !svn then require( "svn" ) end concommand.Add( "svn_cleanup", function( ply, cmd, args ) if ( IsValid( ply ) and ply:IsAdmin() ) or ply == NULL then local successstr = svn.cleanup( "garrysmod/addons/mymod" ) and "successful" or "unsuccessful" if IsValid( ply ) then ply:ChatPrint( string.format( "[SVN] Cleanup: %s", successstr ) ) end end end ) concommand.Add( "svn_update", function( ply, cmd, args ) if ( IsValid( ply ) and ply:IsAdmin() ) or ply == NULL then local latestversion = 0 local status, err = pcall( function() latestversion = svn.update( "garrysmod/addons/mymod", args[1], args[2] ) end ) if !status and err then if IsValid( ply ) then ply:ChatPrint( string.format( "[SVN] Error: %s", err ) ) end else if IsValid( ply ) then ply:ChatPrint( string.format( "[SVN] Updated mod to revision %s", latestversion ) ) end timer.Simple( 5, function() RunConsoleCommand( "changegamemode", game.GetMap(), GAMEMODE.FolderName ) end ) end end end )[/lua]
[QUOTE=blackops7799;28530829]Figured I'd bump this since the fixed version may get lost within the WAYWO thread. Thanks to chrisaster for fixing it. [url]http://www.blackopsservers.com/blackops/files/gm_svn.zip[/url] The dll contains update, commit, cleanup, and checkout. [code] svn.update( path, user, pass ) // Returns revision number svn.cleanup( path ) // Returns a bool to determine if it was successful or not svn.checkout( path, folder, user, pass ) // Returns revision number svn.commit( path, user, pass ) // Returns revision number. Was too lazy to get the update message working [/code] Some example code [lua]if !svn then require( "svn" ) end concommand.Add( "svn_cleanup", function( ply, cmd, args ) if ( IsValid( ply ) and ply:IsAdmin() ) or ply == NULL then local successstr = svn.cleanup( "garrysmod/addons/mymod", args[1], args[2] ) and "successful" or "unsuccessful" if IsValid( ply ) then ply:ChatPrint( string.format( "[SVN] Cleanup: %s", successstr ) ) end end end ) concommand.Add( "svn_update", function( ply, cmd, args ) if ( IsValid( ply ) and ply:IsAdmin() ) or ply == NULL then local latestversion = 0 local status, err = pcall( function() latestversion = svn.update( "garrysmod/addons/mymod", args[1], args[2] ) end ) if !status and err then if IsValid( ply ) then ply:ChatPrint( string.format( "[SVN] Error: %s", err ) ) end else if IsValid( ply ) then ply:ChatPrint( string.format( "[SVN] Updated mod to revision %s", latestversion ) ) end timer.Simple( 5, function() RunConsoleCommand( "changegamemode", game.GetMap(), GAMEMODE.FolderName ) end ) end end end )[/lua][/QUOTE] Could you explain how to use svn.commit? because it would need a folderpath and a repository url, wouldn't it? [editline]e[/editline] [lua] print(svn.checkout("garrysmod/addons/" , "http://tgifallen.googlecode.com/svn/trunk/UpdateChecker.lua" ,"" ,"" ) ) [/lua] that crashes my 3 out of 3 times when called serverside in singleplayer.
[QUOTE=TGiFallen;28532381]Could you explain how to use svn.commit? because it would need a folderpath and a repository url, wouldn't it? [editline]e[/editline] [lua] print(svn.checkout("garrysmod/addons/" , "http://tgifallen.googlecode.com/svn/trunk/UpdateChecker.lua" ,"" ,"" ) ) [/lua] that crashes my 3 out of 3 times when called serverside in singleplayer.[/QUOTE] Heh, I think you're right. I'll take a look at it. [editline]10th March 2011[/editline] You should be using commit like this. [lua]svn.commit("garrysmod/addons/youraddon", "username", "password")[/lua] and checkout like this [lua]svn.checkout( "http://tgifallen.googlecode.com/svn/trunk/", "garrysmod/addons/youraddonname" )[/lua] If there is no username or password, just don't pass the username and password arguments. If it's still crashing upload the dump.
[QUOTE=blackops7799;28533051]Heh, I think you're right. I'll take a look at it. [editline]10th March 2011[/editline] You should be using commit like this. [lua]svn.commit("garrysmod/addons/youraddon", "username", "password")[/lua] [/QUOTE] I don't understand how that will work, how does it know the url of your repository? [editline]e[/editline] here are two dumps from using svn.checkout properly, one was run in menu environment, the other ran in singleplayer [url]http://dl.dropbox.com/u/5853103/crash_hl2.exe_20110310195608_1.dmp[/url] [url]http://dl.dropbox.com/u/5853103/crash_hl2.exe_20110310195238_1.dmp[/url]
[QUOTE=TGiFallen;28534997]I don't understand how that will work, how does it know the url of your repository?[/QUOTE] Same way that it knows the url for svn.update? [editline]10th March 2011[/editline] Fixed the checkout crash. Will upload in a minute.
[QUOTE=blackops7799;28535540]Same way that it knows the url for svn.update? [editline]10th March 2011[/editline] Fixed the checkout crash. Will upload in a minute.[/QUOTE] ohh i see, well do you think you could add a fourth argument as an svn repository? so i can commit non svn'ed things?
[QUOTE=TGiFallen;28536385]ohh i see, well do you think you could add a fourth argument as an svn repository? so i can commit non svn'ed things?[/QUOTE] In order to commit stuff to a svn in needs to be inside the svn'd directory. It's the same as if you commited files using tortoise svn.. Anyway, I updated the download: [url]http://www.blackopsservers.com/blackops/files/gm_svn.zip[/url]
[QUOTE=blackops7799;28536492]In order to commit stuff to a svn in needs to be inside the svn'd directory. It's the same as if you commited files using tortoise svn.. Anyway, I updated the download: [url]http://www.blackopsservers.com/blackops/files/gm_svn.zip[/url][/QUOTE] Alright, thanks i'll just have to make my own .svn files.
[QUOTE=blackops7799;28536492]In order to commit stuff to a svn in needs to be inside the svn'd directory. It's the same as if you commited files using tortoise svn.. Anyway, I updated the download: [url]http://www.blackopsservers.com/blackops/files/gm_svn.zip[/url][/QUOTE] Please add svn cleanup, there could be an svn lock with an lua plugin and cause this to fail. Good work so far though!
[QUOTE=Buggzie;28541886]Please add svn cleanup, there could be an svn lock with an lua plugin and cause this to fail. Good work so far though![/QUOTE] [url=http://www.facepunch.com/threads/774190-gm_svn-SVN-update-from-within-GMod?p=28530829&viewfull=1#post28530829]Read my post very carefully.[/url] [editline]11th March 2011[/editline] I also added another optional argument to update and checkout which allows you to specify a specific revision to get. Just leave it blank or pass nil, like username and password, if you want the latest revision.
Is this still locking? IE, freeze the server while it is running, or can it be run silently in the background?
[QUOTE=mr.wolf;28547322]Is this still locking? IE, freeze the server while it is running, or can it be run silently in the background?[/QUOTE] Still blocking.
[QUOTE=mr.wolf;28547322]Is this still locking? IE, freeze the server while it is running, or can it be run silently in the background?[/QUOTE] yeah it still chokes the server up.
[QUOTE=blackops7799;28544301][url=http://www.facepunch.com/threads/774190-gm_svn-SVN-update-from-within-GMod?p=28530829&viewfull=1#post28530829]Read my post very carefully.[/url] [editline]11th March 2011[/editline] I also added another optional argument to update and checkout which allows you to specify a specific revision to get. Just leave it blank or pass nil, like username and password, if you want the latest revision.[/QUOTE] my bad.
Any update and could this be made for serverside too?
Looks like the download link is broken, could somebody please re-upload it. Thanks.
[url]http://www.breakpointservers.com/blackops/gm_svn.rar[/url]
I don't think it works anymore, when i try to require it tells me it gets an error loading the module, saying the specified procedure could not be found.
The version Blackops posted works fine.
Not for me. It says the same thing, It apparently cannot be found
Have you copied all the binaries inside the bin folder (from the rar file) near your hl2.exe, inside your garrysmod folder? You should also check for the C++ redistributables, it usually fixes a lot of stuff.
I messaged Blackops and yeah, it is *semi* broken, on the client on of the additional dlls you have to put in "steamapps/garrysmod/bin" is being overwritten by valve, so you have to manually replace it.
You don't have to place them in "steamapps/garrysmod/bin", you simply place them near your hl2.exe ("steamapps/garrysmod") and it will work fine (it does for me at least). And I bet nothing will get overwritten there.
[QUOTE=danielga;32503924]You don't have to place them in "steamapps/garrysmod/bin", you simply place them near your hl2.exe ("steamapps/garrysmod") and it will work fine (it does for me at least). And I bet nothing will get overwritten there.[/QUOTE] Ahh, I'll try that, I was only following the instructions the readme gave me and that was erroring.
Sorry, you need to Log In to post a reply to this thread.