Working Copy and Codea -- current practice?

A colleague, Andy Hunt of Pragmatic Programmers, tweeted how cool Working Copy is, which raises my interest. I’m presently using Codea-scm, which works quite nicely.

What are the present preferred ways of using Working Copy? Is WCCC the tool to use? Is there a way that doesn’t require a tool written in Codea? What are ways, what are pros and cons?


You want to be asking @yojimbo2000

He’ll notice now but interested to see whether others are using it and have ideas. :slight_smile:

I think it should now be possible to use Working Copy and Codea together without an intermediary like WCCC. Working Copy is evolving very quickly (the upcoming conflict resolving tool is very cool), and the way it handles zip imports has changed subtly. Duplicate a Codea project to test with, create a “zipped project export” and then experiment with the different zip import features Working Copy offers (unzip into folder, unzip into repository). Make changes to the Codea project (edit some tabs, change tab order, rename tabs, delete them), then repeat the process, and see whether you think it is OK as a “push” option.

Last time I tried this a few versions of Working Copy back, I think what I did was set up the repo in Working Copy first, and then created a folder in that repo called [project name].codea, then chose the “unzip to folder” option from Working Copy’s import options.

AFAIR I thought it worked OK, except when files were renamed/ deleted, and the old file would persist in the repo in Working Copy and would need to be deleted manually (not too arduous a step, just swipe the file to the right in Working Copy and hit delete). In other words, unzipping into an existing folder with files in it is like dragging a bunch of files into a folder on the desktop: it will overwrite files in the folder with the same name as those being copied, but won’t touch files whose name doesn’t correspond to any files in the new batch (ie, tabs you’ve renamed or deleted).

It could be that this behaviour has changed, so you might need to experiment. I use WCCC, so I haven’t tried this for a while.

In terms of the other direction, coming into Codea, that should be even easier with the “Export to Codea” option, the only issue being that you can only do “paste-into-project” with a new project, not an existing one, so you would lose data saved into the old project (with save project data, or assets saved in “Project:” folder etc).

I’d also be interested in hearing other people’s workflows.

Some testing. Convinced Working Copy and Codea to see each other. Learned how to send a project to WC, and did two commits. Saving locally. Have not figured out how to bring a version back in yet. Have not figured out how to create a github repo. Looks like there must be a way to do that …
So seeming just now like WCCC is no longer needed? Or is it?

On the WCCC thread:

There are some advantages to using WCCC though. Mainly, “paste-into-project” is only possible with a new project, you can’t paste into an existing one. This could be a problem if you’re trying to restore an earlier build but you have project data or assets in your project folder. WCCC’s pull command will overwrite the tabs in the existing project, so it’s useful if you need to roll back your code, but you want to otherwise keep the project folder as is (TBH I just put all assets in Dropbox, I never use the project asset folder). Secondly, WCCC will remember which repos in Working Copy are connected to which Codea projects, which is useful. Finally, if you rename or delete a tab, WCCC will remove the old tab from the repo, whereas if you’re using zipped project export to push those kinds of changes, the old tab will need to be deleted by hand in the repo.

TBH, the most useful one is number 2. If you have hundreds of projects in Codea, a tool that remembers which ones are synced to which repos I find useful.

What I should do to make WCCC “competitive” feature-wise, is add support for pushing and pulling assets as well as code. Way too busy right now to implement that though.

Yes, I think I just discovered that to revert a project from WC. I can only copy and paste to a new project. I like WC’s making the versions visible and its diff, but of course I get that when using WCCC as well. Guess I need to refresh WCCC but if I recall it knows how to do that. More experimentation I guess …
Thanks … more comments / feedback / ideas welcome.

another question: i have a github repo made with codea-scm. if i start using WC on it, am I going to get in trouble? thanks!

No I don’t think so. But for working copy’s “export to Codea” function to get your tabs in the right order, info.plist should be in the same folder as the tabs.

i’ll give it a try. maybe clone it down first just in case :slight_smile:

I can’t find an “Export to Codea” function in Working Copy. Can someone point me in the right direction?

Away from my iPad just now, but I think as long as you’re in a folder that has some .lua files in it, hit the share button, and “export to Codea” should be one of the options in the lower, “action” pane of the share window.

Hi @yojimbo2000, I see “Copy as Codea Project” but not export to. I think there’s something I don’t understand about WCCC going on as well. It’s about the push and pull buttons. When I want to revert something, I go to Working Copy, check out the branch, then ask WCCC to Pull. It gives me a message about needing to “pish” first :slight_smile: even though I think everything is over in Working Copy.

Could that message mean that there are changes in my project that I’ve not checked in? Does WCCC even know that?

Can you clue me in a bit on what’s going on here? Thanks!

Yeah, Working Copy’s built-in Codea export function is “Copy as Codea Project”. It places all the .lua files into a single string in the clipboard that is compatible with Codea’s “Paste into Project” button. If the Info.plist is in the same folder in the repo, Working Copy will use that to get the tab order correct. Given that Apple asked IDEs like Codea and Pythonista to remove themselves as targets for the “Open In” pane, this is likely the best out-of-the-box “export to Codea” we’re likely to see.

Thanks for the heads-up over the typo! This is one of those “safety” features that perhaps doesn’t work as well as I intended so should probably just be taken out of WCCC. What is happening (or used to happen) was:

  1. When you pushed from WCCC, WCCC would store the SHA1 hash of the project you pushed, a neat way of keeping a record of the project you pushed, without taking up too much space.

  2. Then, when you try to Pull back in, WCCC compares the current state of the Codea project to the stored SHA1 hash, to see if you’ve changed anything locally since you last pushed. If the hashes don’t match, it advises you to “push” (or pish) first (tho obviously that should be to the head of the repo, NOT to the earlier version that you checked out), to ensure that nothing is lost. But I think it gives you a “Pull Anyway” option, doesn’t it? So if you don’t care about losing your most recent changes, or you know that they were only trivial changes, then you can still go ahead and pull.

What is happening tho, is that I took out the step of creating the SHA1 key when you push, because for longer projects it was taking too long to generate the key, and falsely said that the push had failed if a tab had been renamed or deleted. But I’ve clearly forgotten to remove the SHA1 checking from the “pull” method. So the warning/ advice to “push first” is being generated regardless of whether you’ve made changes, because WCCC finds no earlier SHA1 hash to compare against, so thinks you haven’t previously pushed the project. When I get some time I’ll go through and properly remove the SHA1 hashing, and these warnings it generates.

Do you see a “pull anyway” button, and are you able to pull in the earlier version? Your steps sound correct. Check-out the earlier version, then pull. If you decide this is a version you want to develop from, then create a new branch in Working Copy from the section you’ve checked out.

Yes, thanks, I just went ahead and pulled anyway, since I knew the previous checkout wasn’t crap and what I had was. :slight_smile: Just wasn’t sure I understood what was up. Thanks!