Mafia SVN for Scripts?

Winterbay

Active member
Do right click folder> tortoisesvn > rename... then commit changes.

In windows, files are not case sensitive, but in svn they are. So if you try to just change case (and nothing else) in windows explorer, it's going to break things.

Thanks, that worked. Now I just need to come to terms with the fact that I have the same files in two locations (SVN folder and Mafia-folder), but I think I can live with that :)
 

Bale

Minion
OMG! OMG! OMG! It's awesome, awesome, AWESOME!!!!!

If anyone has ever thought about trying ChIT, but thought it was too much trouble to install so many files in three different directories, then rejoice! ChIT can now be installed with a single CLI command!

svn checkout https://svn.code.sf.net/p/mafiachit/code/

Code:
> svn checkout https://svn.code.sf.net/p/mafiachit/code/

Validating repo...
Repo validated.
C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\svn\mafiachit
A https://svn.code.sf.net/p/mafiachit/code/images
A https://svn.code.sf.net/p/mafiachit/code/images/chit
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/medium_orange.gif
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/select_mood.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/stats.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/refresh.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/mcdoff.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/mcdon.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/collapse.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/helpers.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/busy.gif
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/questsnone.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/medium_blue.gif
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/select_outfit.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/trail.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/elements.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/moodsave.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/moodnone.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/Elements2.gif
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/upred.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/modifiers.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/helpersnone.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/update.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/mcdnone.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/moodplay.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/quests.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/up.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/moodburn.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/organs.png
AU https://svn.code.sf.net/p/mafiachit/code/images/chit/medium_red.gif
A https://svn.code.sf.net/p/mafiachit/code/data
A https://svn.code.sf.net/p/mafiachit/code/data/chit_ReadMe.Txt
A https://svn.code.sf.net/p/mafiachit/code/data/chit_effects.txt
A https://svn.code.sf.net/p/mafiachit/code/relay
A https://svn.code.sf.net/p/mafiachit/code/relay/chit.js
A https://svn.code.sf.net/p/mafiachit/code/relay/charpane.ash
A https://svn.code.sf.net/p/mafiachit/code/relay/chit.css
https://svn.code.sf.net/p/mafiachit/code
At revision 1

Successfully checked out working copy.
Pushing local updates...
chit.css => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\relay\chit.css
charpane.ash => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\relay\charpane.ash
chit.js => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\relay\chit.js
chit_effects.txt => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\data\chit_effects.txt
chit_ReadMe.Txt => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\data\chit_ReadMe.Txt
medium_red.gif => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\medium_red.gif
organs.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\organs.png
moodburn.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\moodburn.png
up.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\up.png
quests.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\quests.png
moodplay.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\moodplay.png
mcdnone.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\mcdnone.png
update.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\update.png
helpersnone.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\helpersnone.png
modifiers.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\modifiers.png
upred.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\upred.png
Elements2.gif => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\Elements2.gif
moodnone.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\moodnone.png
moodsave.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\moodsave.png
elements.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\elements.png
trail.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\trail.png
select_outfit.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\select_outfit.png
medium_blue.gif => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\medium_blue.gif
questsnone.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\questsnone.png
busy.gif => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\busy.gif
helpers.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\helpers.png
collapse.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\collapse.png
mcdon.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\mcdon.png
mcdoff.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\mcdoff.png
refresh.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\refresh.png
stats.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\stats.png
select_mood.png => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\select_mood.png
medium_orange.gif => C:\Documents and Settings\David\My Documents\Dropbox\KolMafia\images\chit\medium_orange.gif
Done.
 

roippi

Developer
Now I just need to come to terms with the fact that I have the same files in two locations (SVN folder and Mafia-folder), but I think I can live with that :)

For what it's worth I'm planning on more fully fleshing out the integration between the mafia folder (I'll call this "local copy") and the svn folder("working copy"). Example:

Right now if there's an update to a file on the repository, svn update does the following:

1) Update the working copy file, mark it for local updates
2) Local updates check that the local copy exists
3) Local copy exists, working copy file then overwrites local file. Done.

I think that it would be cool if before 1) we first see if there's any difference between the "local" file and the "working copy" file, and if yes merge the changes into the working copy. Then svn update happens, merges the updates from the repo into your working copy file, and finally that gets copied into your local file.
 

lostcalpolydude

Developer
Staff member
I got my script set up. After doing svn checkout, I made some changes in the working copy (using your terminology), then committed the changes (using TortoiseSVN). Is there a better way to get those changes to my local copy besides copy-pasting the file between folders?
 

Bale

Minion
Like lostcalpolydude, I want a command for "svn commit" so I am quite happy it is on your list of things to do.

Even more important me though is to be able to put an svn updated script into a customized location so that I won't have scripts like BatBrain, zlib and so forth cluttering up my scripts menu. I don't call them directly so I want them in a subfolder.

Hang in there roippi, this is the most amazingly paradigm shifting update to mafia since jason added the maximizer.
 
Last edited:

roippi

Developer
I think I'll add one or two new preferences, syncBeforeUpdate and syncAfterUpdate.

The former pref looks at each working copy file and does a comparison with the corresponding local copy file. If there is a difference, the local is merged into the working copy (note:different from one overwriting another). It does nothing if the two files are the same byte-for-byte. This is useful for users who make tweaks to their local copy and want them to persist through an update without manually copying the file to the working copy every time they change something. It's quite tricky if both the working copy and the local copy contain modifications... hmm I'll have to think about that.

The latter pref does the above in reverse syncing the WC to the local after an update. This is less useful for many users since when a file updates from the repo, that triggers the working copy to overwrite the local copy entirely. The exception is if you're like lost and use the working copy in svn/ to commit your changes from - when you update, your working copy is already synced with the repo. That means no update event fires and nothing gets pushed to the local copy.

These will be opt-in most likely as they are not computationally cheap operations to do. We'll see though, I'm just in the conceptual stage on it.
 

roippi

Developer
Like lostcalpolydude, I want a command for "svn commit" so I am quite happy it is on your list of things to do.

Even more important me though is to be able to put an svn updated script into a customized location so that I won't have scripts like BatBrain, zlib and so forth cluttering up my scripts menu. I don't call them directly so I want them in a subfolder.

Hang in there roippi, this is the most amazingly paradigm shifting update to mafia since jason added the maximizer.

Glad you like it.

svn commit is possible. I will likely require authentication to be passed as arguments; dealing with external authentication files is obnoxious.

As for being able to arbitrarily move around local copies... I don't know man. That sounds like a huge nightmare. I wouldn't know where to begin with making a system that can map default locations to new locations... Hm, maybe it's doable (anything is doable), but it'll have to wait for the GUI.
 

Bale

Minion
As for being able to arbitrarily move around local copies... I don't know man. That sounds like a huge nightmare.

Then I would like to make a request for zarqon, Winterbay and anyone else who writes functions like BatBrain, zlib, newLife and WHAM which are designed to be consulted by mafia or other scripts, without being called directly by the user from the script menu.

Please, please, please! How about we put all those scripts in the "/scripts/consult scripts" directory? I'll also put newLife and other hook scripts of my own into the "consult scripts" subdirectory so that they won't clutter up people's script menu. Would my fellow scripters hate this as a standard? Surely I'm not the only one who likes to put them in a subdirectory, but unless we can agree on the subdirectory's name we'll make a lot of clutter.

If you don't like the name consult scripts, hopefully we can agree on another name for a directory to put these consulting and mafia hook scripts into.
 
Last edited:
I. Love. You.
SO HARD.
Any files or directories in the location specified by your url that are not named the above will cause your repo to fail validation and thus it will not be checked out.

I have no idea how validation works internally, but... would it be possible to instead ignore not-allowed directories instead of outright failing?
I've been using a repo for my clan bot forever and he has some other stuff that would be possible to move out, but would wonk up the file structure a bit (namely, the CCS folder would have to be moved out, not a huge deal).

Either way, this will make all my everything infinitely better, and you are my hero.

EDIT TO ADD:
How about we put all those scripts in the "/scripts/consult scripts" directory? I'll also put newLife and other hook scripts of my own into the "consult scripts" subdirectory so that they won't clutter up people's script menu. Would my fellow scripters hate this as a standard? Surely I'm not the only one who likes to put them in a subdirectory, but unless we can agree on the subdirectory's name we'll make a lot of clutter.

If you don't like the name consult scripts, hopefully we can agree on another name for a directory to put these consulting and mafia hook scripts into.
Good idea, but... that's a rather unwieldy name. And it has a space in it. Icky. How about the much simpler "libs"?
 

lostcalpolydude

Developer
Staff member
Even more important me though is to be able to put an svn updated script into a customized location so that I won't have scripts like BatBrain, zlib and so forth cluttering up my scripts menu. I don't call them directly so I want them in a subfolder.

Setting scriptMRULength can keep them from being in that menu.

People writing scripts that aren't meant to be called directly could put them in /scripts/support or something like that, but chances are there would be a lot of people that don't delete the old version from /scripts and wonder why they run into problems.
 

Bale

Minion
I've been using a repo for my clan bot forever and he has some other stuff that would be possible to move out, but would wonk up the file structure a bit (namely, the CCS folder would have to be moved out, not a huge deal).

Actually, to me ccs seems like a good addition to allowable folders. I'm not sure what the OST folder is about or why it shouldn't be moved. I'll let Roippi figure out why he prefers failure to skipping.


Good idea, but... that's a rather unwieldy name. And it has a space in it. Icky. How about the much simpler "libs"?

libs works for me. Alternately, lost suggested support which also works for me. Or we could shorten my original suggestion to consulting.

I prefer support and consulting to libs simply because most of these scripts are not libraries. WHAM for instance could be categorized as support or consulting, but not a lib.
 
Ah, that's fine then. I honestly don't really know what consult scripts are or how they work (things like Between Battle Scripts??). I was just going with what I was familiar with, which was "stuff that gets import<>ed and not executed" which, while they may not necessarily be libraries, are analogous. Really, I'm fine with "support" as well.

As for the OST folder, it has nothing to do with mafia (in terms of file structure, at least) and could be easily removed, if ignoring isn't an option.
 

livercat

Member
It seems that svn requests don't use the proxy information. I was able to checkout/update repos from home (without proxy), but at work (with proxy) it fails:
Updating /p/mafiachit/code
Validating repo...
Something went wrong while fetching svn directory info
D:\Dropbox\kolmafia\svn\mafiachit
At revision 7
Done.
 

Bale

Minion
It seems that svn requests don't use the proxy information. I was able to checkout/update repos from home (without proxy), but at work (with proxy) it fails:

meowtiger reported the same problem in another thread. There's definitely a problem with using a proxy server.

it could just be due to my web proxy since i play from work .. but i'm getting the following from within mafia, I can browse to the url via browser using the same web proxy.
Code:
svn checkout https://svn.code.sf.net/p/mafiachit/code/

Unable to connect with repository at /p/mafiachit/code

Roippi, should we make a bug report for this, or just give you some time?
 

roippi

Developer
I suppose ccs/ could go through validation, there's not much harm in that.

Unfortunately skipping things is not an option. I don't mean that in a that-would-be-difficult sense, but rather an I-would-have-to-completely-rewrite-svn-from-scratch sense. Working copies simply do not allow you to pick and choose what to check out of it. I have some control over recursion depth, but that's about it.

Go ahead and bug report the proxy thing, that's not something I know how to fix off the top of my head. Nor is it particularly high priority for me right now.

(also I'd vote for scripts/lib/ for naming convention)
 
Last edited:

fronobulax

Developer
Staff member
Then I would like to make a request for zarqon, Winterbay and anyone else who writes functions like BatBrain, zlib, newLife and WHAM which are designed to be consulted by mafia or other scripts, without being called directly by the user from the script menu.

Please, please, please! How about we put all those scripts in the "/scripts/consult scripts" directory? I'll also put newLife and other hook scripts of my own into the "consult scripts" subdirectory so that they won't clutter up people's script menu. Would my fellow scripters hate this as a standard? Surely I'm not the only one who likes to put them in a subdirectory, but unless we can agree on the subdirectory's name we'll make a lot of clutter.

If you don't like the name consult scripts, hopefully we can agree on another name for a directory to put these consulting and mafia hook scripts into.

As noted there are better directory names. I will say, however, that there are consult scripts that are called directly. For example, although newLife is invoked automagically, I also tend to run it manually after any update to newLife that might effect my current run.

Personally I don't care whether this happens or not, so long as it does not require me to use sub-directories in my script directory. I am happy with the MRU feature and control my clutter by controlling the length. When I invoke a script from the directory listing I actually want every script since I often don't remember names. I also seem to recall that doing so would validate a script even if there was nothing to execute and sometimes I found that valuable. So if it happens make it opt in and let me keep newLife at the "top" level, please.
 

lostcalpolydude

Developer
Staff member
So if it happens make it opt in and let me keep newLife at the "top" level, please.

That would be impossible. Either zlib (or whatever) is in /scripts, and that's where mafia puts it, or it's in /scripts/lib and that's where mafia puts it, and everyone is going to get the same folder setup presented to them.

I just "verify scriptname" when I want to validate it, no need to try running it.
 

roippi

Developer
People connecting through proxies can try the latest revision, I have no idea if that will help.

Also, putting stuff in ccs/ is permissible now.

That would be impossible. Either zlib (or whatever) is in /scripts, and that's where mafia puts it, or it's in /scripts/lib and that's where mafia puts it, and everyone is going to get the same folder setup presented to them.

It's not technically impossible to let users move things around. Much as validate script.ash will use KoLMafiaCLI.findScriptFile( final String filename ) to find which .ash file you're talking about, svn could do the same thing when it's resolving the "rebase" of a file based in scripts/. This has a number of unintended consequences, since that rebase behavior also applies to delete operations.

I'm also not averse to telling people that they're being unreasonable in asking for legacy behavior to be maintained and telling them Sorry But No. When windows update (or apt-get, whatever) installs new drivers, you can't arbitrarily move those files around and expect everything to work. I don't see why you should here.
 

fewyn

Administrator
Staff member
So many posts! Was there actually something I needed to do with the build bot? I'll look into setting up SVNs shortly or at least make a way so I can create them easily for whoever wants them.
 
Top