Mafia SVN for Scripts?

bumcheekcity

Active member
I recall discussion a while back on possibly having some sort of separate Mafia SVN for ASH scripts, so we could keep them all up-to-date at once.

For the life of me, I can't find the script, but I continue to think it'd be a great idea. Did anyone get anywhere with this, or was it found to be too tricky?
 

fronobulax

Developer
Staff member
There was some discussion of building a SVN client into Mafia, specifically to handle scripts and datafiles. I was leading the discussion with the intent of implementing it but things got in my way. There was an issue with Java versions between KoLmafia and the library I was going to use, but I think those were resolved. I changed jobs and am writing Java professionally again which means working on KoLmafia is like work and not a fun exercise that looks good on my resume. I was underwhelmed by the level of interest, but your question changes that. Finally I was unable to figure out a collection of SVN commands that would update exactly one specific file. The latter is the show stopper for me. What I should do, unless someone beats me to it, script a way to use SVN to keep my copies of your scripts up to date. That would either serve as inspiration or confirm that it is more trouble than it is worth.
 

heeheehee

Developer
Staff member
SVN in all its glory might be overkill, especially considering that in general these repositories would only have one (or a few) files at any given time. The "easiest" (i.e. least amount of thought required) solution would be to just use a separate folder for each script, each of which is backed by a different SVN repository.

I'd suggest something with diff/patch, but versioning gets a bit weird (unless you manually keep track in some metadata file, but then you're inventing your own version control). There's probably something out there that specializes in small, separately-versioned files, though.
 

Theraze

Active member
Which would also make things somewhat less convenient for end users who can currently just type in the script filename who will need to do folder\filename. For example, back when it wasn't in the SVN folder, I could just run bumcheekascend by typing bumcheekascend. Now that there's a folder with that name, I need to do bumcheekascend\bumcheekascend to run it. Since I know it works like that now, I can deal with it, but... wouldn't want to inflict that on newbies.
 

Winterbay

Active member
Which would also make things somewhat less convenient for end users who can currently just type in the script filename who will need to do folder\filename. For example, back when it wasn't in the SVN folder, I could just run bumcheekascend by typing bumcheekascend. Now that there's a folder with that name, I need to do bumcheekascend\bumcheekascend to run it. Since I know it works like that now, I can deal with it, but... wouldn't want to inflict that on newbies.

No you don't... You can just type bumcheekascend and it'll run just fine. At least it works just fine for me... And all other scripts I have in sub-folders, sometime 3 layers in...
 

roippi

Developer
The Java SVN library in question is SVNKit and the discussion on importing it into mafia starts somewhere in the middle of this thread.

My issue is mostly how best to integrate it into the ASH language and I haven't had/heard of any good ideas on that front yet.
 

heeheehee

Developer
Staff member
SVN in all its glory might be overkill, especially considering that in general these repositories would only have one (or a few) files at any given time. The "easiest" (i.e. least amount of thought required) solution would be to just use a separate folder for each script, each of which is backed by a different SVN repository.

So I just realized that extra folders break relay_[whatever] scripts (or at the very least, cause them to be undetected. A workaround would be to create symlinks, but that might be more of a hassle than it's worth.)

My issue is mostly how best to integrate it into the ASH language and I haven't had/heard of any good ideas on that front yet.

Warning: the below ideas are totally half-baked.

I would advocate cli_execute("update scripts"), but I think I'd want a way to control this on a per-script basis.

Maybe void check_for_updates(), which must be top-level code, requires a unique script name (specified via script identifier, or possibly filename --- I'd like to propose adding an author identifier, but that might break some existing scripts), and restarts (via exiting / rerunning) the script if it updated? (optionally, preference for manual user confirmation for each update).

edit: not sure how I'd want uploading of new scripts to work. On one hand, I'd like it to be somewhat collaborative (so if an author disappears off the face of the kingdom, then scripts don't _have_ to die), but on the other hand, I'd want quality control, Maybe I'll have more half-baked visions.
 
Last edited:

roippi

Developer
I was thinking of a top-of-the-script keyword a la notify (perhaps "repo") that specified a URL to an SVN repo. The "update scripts" command either

-recursively looks through scripts/ and relay/ for .ash files and sees if they have a "repo" directive, and if so performs an SVN update using that repo, or
-upon running an ash script with the "repo" directive, that script/repo combination is registered with mafia. "update scripts" first checks that that script exists, and if so does an SVN update operation; if the script is missing (user probably deleted it), the script is unregistered.

Or something like that. The latter option has the advantage of extensibility - perhaps eventually creating a centralized script browser, where one could one-click install scripts from within the mafia interface. I dunno, just daydreaming at this point.
 

Theraze

Active member
No you don't... You can just type bumcheekascend and it'll run just fine. At least it works just fine for me... And all other scripts I have in sub-folders, sometime 3 layers in...

> bumcheekascend

Unable to invoke bumcheekascend

> bumcheekascend\bumcheekascend

******************************************************************************************
******************************************************************************************
******************************************************************************************
Thankyou for using bumcheekcity's ascension script. Please report all bugs on the sourceforge page available in my profile with a copy+paste from the CLI of the problematic points, and your username. Ask on the thread on the kolmafia.us forum for help and assistance with the script, particularly first time problems, and issues setting it up.
******************************************************************************************
******************************************************************************************
Not for me...
 

roippi

Developer
A separate issue about svnkit is that importing the whole lib .jar adds 3 MB to the kolmafia .jar size. I can probably pull out only the .class files I need and just import those, but man is that a pain in the butt. Why can't things just work

Not for me...

add .ash
 

Winterbay

Active member
Not for me...

Odd...

Code:
[COLOR=olive]> bumcheekascend[/COLOR]

Sending kmail to      bumcheekcity...
[COLOR=purple]******************************************************************************************[/COLOR]
[COLOR=purple]******************************************************************************************[/COLOR]
[COLOR=purple]******************************************************************************************[/COLOR]
[COLOR=purple]Thankyou      for using bumcheekcity's ascension script. Please report all bugs on the      sourceforge page available in my profile with a copy+paste from the CLI of      the problematic points, and your username. Ask on the thread on the      kolmafia.us forum for help and assistance with the script, particularly      first time problems, and issues setting it up. [/COLOR]
[COLOR=purple]******************************************************************************************[/COLOR]
[COLOR=purple]******************************************************************************************[/COLOR]
[COLOR=purple]******************************************************************************************[/COLOR]

[COLOR=purple]BCC:      Trying to check bcs_aliases on the Bumcheekcity servers.[/COLOR]
[COLOR=green]******************[/COLOR]
[COLOR=green]Ascending      Starting[/COLOR]
[COLOR=green]******************[/COLOR]
Conditions      list cleared.
[COLOR=purple]BCC: Trying to check      bcsrelay_settings on the Bumcheekcity servers.[/COLOR]
[COLOR=red]KoLmafia      declares world peace.
[/COLOR]

I double checked and I have no alias for it. Mine is in Mafia/Scripts/BCC/SVN Base/ which is several folders down and it still works fine. May it be because your folder and the script is called the same thing?
 

bumcheekcity

Active member
Maybe a whole SVN might be a bit overkill. Would it be possible for script authors to be able to upload scripts to the website, and for the Java program to be able to pull them off via HTTP - kind of like how we all check the first page of the forum topic for the version number, and then print a message telling people to download the latest version - but possibly with some sort of vBulletin files extension allowing this to be done automatically?
 

fronobulax

Developer
Staff member
As a user, I want something that will tell me that there is a newer version of a supported script and give me the option to download it and replace my version with the author's version. If I accept the option then I am willing to have any local changes I have made overwritten. If the author has both the latest version and the released version I want the ability to choose one or the other and if I go for the latest version, I want some kind of labeling that indicates the version I actually grabbed.

I focused on SVN because it looked as if I would not have to reinvent the wheel, but it is only one way to accomplish the task and I have to agree with roippi that jar size bloat is definitely something to consider, that I had not.

As a user my "problem" occurs because bcc uses SourceForge and SVN, several other folks use the forum and zarqon's zLib conventions and a couple other folks "roll their own". And I use and rely on scripts from each of them.

As a dev, I don't want to compel script writers to do anything but I do want to offer them a capability that is so compelling that they will voluntarily convert to it.
 

roippi

Developer
I prefer local changes being merged rather than overwritten. That is much more compelling to me as a feature. So I wouldn't be interested in implementing anything less sophisticated than that.

I don't think jar size should inflate too much if I just pull out the .class files I need. It's something I should probably figure out sooner rather than later, though. I don't care to find out down the line that my only option is to inflate .jar size by 3 megs.
 

Theraze

Active member
I double checked and I have no alias for it. Mine is in Mafia/Scripts/BCC/SVN Base/ which is several folders down and it still works fine. May it be because your folder and the script is called the same thing?

See, this is exactly what I said. Yours isn't in the bumcheekascend folder, it's in the Scripts/BCC/SVN Base/ folder. :)

Why it doesn't work on mine is because there's an exact match that's found earlier. And while we can tell newbies whose auto-updating scripts suddenly don't work to use .ash or the exact file location to disambiguate, it does represent a potential change in gCLI behaviour if mafia puts the script files into same-named folders. :)
 

fronobulax

Developer
Staff member
I deliberately dropped merge from my initial feature set because it is just fraught with too many opportunities for automation to do the wrong thing. In the back of my mind I was thinking what would probably happen is that automation would rename the old file, download the new file and the user would manually merge using the diff utility of their choice. I'm probably paranoid because SVNs built in merge capability has screwed my code more than it helped it. YMMV.

As for directories given that SVN keeps data locally I was thinking of a new mafia subdirectory rooted at downloads or something similar. SVN would check out into that and then move/copy files to scripts. I did not think I wanted to clutter scripts with a .svn directory nor try and deal with multiple repositories there. Like I said, though, I have only thought this through so far and the last effort petered out because my ideas weren't compelling enough for me to implement and no one else seemed to care very much.
 

roippi

Developer
If anything I'd consider making merge opt-out with a preference. Modern SVN is quite good about fail-fast behavior when merge doesn't work, and we can prompt the user to handle the problem with little difficulty in that situation.

Right now I'm increasingly concerned about .jar bloat so things may not progress out of the current play-around-with-it phase after all. When I pulled in the SwingX library that added 2 MB to the bill, but I deemed it worth it as the functionality provided therein immediately impacted all users. Here, it's way more marginal, as cool as SVN support would be. Perhaps there's a more lightweight library out there, since it actually doesn't look like I can pare down SVNKit much.
 

bumcheekcity

Active member
In today's day of broadband connections, is a couple of meg really that big of a deal?

Happy to be disagreed with if there are technical or other reasons.
 

roippi

Developer
Every MB I add to the .jar is another meg fewyn has to serve up every time someone updates their .jar. I'd be remiss if I didn't respect the free service he provides to us all.
 
Top