.
Do you have a simple example of a uri you are using? Are you being sure to encodeURI the text file contents?
Sorry, I think it might be
urllib.quote
I figured it out, but I don't have time to finish the code right now. I'll post it when it's done.
By the by, Smath, you may want to pull the latest editmenu if you haven't in a while. I recently updated everything as classes, which fixed some namespace conflicts and other issues when changing folders....
Okay. I just updated the repository, and while I still hope to make improvements, everything is working. Please read the updated instructions on the README before trying to use, or it won't work. Let me know if you still have any questions. Also feel free to improve or suggest how it could be better.
I understand this probably won't be the best thing for everyone, especially people who are used to using git via the command line. It's also not a great idea for large repositories, and in fact breaks down when there are sub-directories in the repository (something I need to fix). Hopefully once I get around to combining steps it will be better for that purpose. I just like the idea of having a git interface built into my pythonista workflow, and since I usually work in small repositories this should work just fine.
JonB - thanks for the suggestion. I'll make sure to get the most current version.
FYI, there is also gitview, which is a ui interface to git.
It still has a lot of work to go
I do like the idea of sidebar commands. I suspect working copy has the capability to handle merges, etc better.
I've noticed a problem with how I'm doing this. When I get text returned from working copy, what I get is a list of words. which I join with spaces. This totally kills my indentation. Any ideas how to fix this without looping through the whole list of words or string? If not I'lll probably give up on this and find some other way to simplify working with git. I may still use this to send stuff to git, but pullling code from git through working copy is turning out to be more complicated than I originally thought.
In the pythonista manual, it says
If you want to pass arguments that contain spaces, you have to enclose them in double quotes (as you would in a classic shell). %22 is an encoded double quote:
For instance
pythonista://printargs?action=run&args=%22foo%20bar%22
produces
['/var/mobile/Applications/88D6E0F3-4BB7-4D36-8AD6-BAF532976A46/Documents/printargs.py', 'foo bar']
Your scripts would have to ensure that there are no
"s in you code. Use single quotes for strings, then you can replace any double quotes inside of strings with \x22.
If you ever need to quote single quotes, you could use triple single quoted strings instead of double quotes.
If you are only using ios, and don't need to share elsewhere, your pythonista code could add double quotes to the file that you check in, which thus ensures that when you get it back from working copy, the quotes get stripped off automatically. Alternatively, you will need the workingcopy author to add the option to surround the encoded code with %22s.
The other options you've got, I think, are:
You could use git from stash, which has been functionalized compared to the pythonista versions. So you could call those from a sidebar.
You could also use gitview, which right now has some additional features, like the ability to checkout old sha's. Once you create the gitui object, you can set the repo programatically, then all the commands should be callable from the gitui object. I have a lot of cleanup and organization to do in that class, but I don't see any real barrier to sidebar integration. Do you have a use css for what git commands you want implemented via sidebars?
Correction: you want to use argv rather than args. Argv does not require quoting.
Okay, I got this working, however, I have been rethinking how good of a path this is. I didn't realize that git had been included in stash. That might be a good route. Is there any reason that it wouldn't work with bitbucket? I know that I can use the same command line commands with bitbucket as github on desktop, but I'm having trouble cloning a bitbucket url with it.
Be sure to include the full extension. Do you have an example url you are cloning?
ok, I reproduced this problem. I suspect it has to do with the authentication method used. Technically I don't see a reason dulwich wouldn't support bitbucket..
The new release of
Working Copyadds x-callback-url commands.
Just so you know, PMB1999 on github submitted an update for that app on 2/28 that should improve functionality substantially from what I had, so make sure you have the current version. I had arranged with the working copy developer to allow sending encoded zip files back to pythonista to allow whole folders to be synced at once, and I believe PMB1999 implemented that along with other improvements. I haven't been able to use it much yet, so I'm not sure of all the changes.
The other option for dealing with the close button is that I could just have all of the buttons moved down. Then no work around will be needed. I'm not sure if that will impact any iPhone users.
By the way, check out my pull request on Github. I think I improved the script a little by removing the need for the user to configure INSTALL_PATH.
v1.8 of Working Copywas released yesterday and it seems to have great new features. I use it to fiddle with GitHub repos but I do not really know how use it to do heavy work between Pythonista and Working Copy and a GitHub repo.
Could someone please document some best practices for
how to use Pythonista and Working Copy together?
A walk-through of the following steps would be a huge help to me:
- Use Working Copy fork an existing repo from GitHub
- Move one (or all) of the Python files from that local copy into Pythonista
- Make a change in one of those Python files
- Move the modified file from Pythonista back into Working Copy
- Push the change into the GitHub repo
5a. A repo to which I have commit rights 5b. As a "pull request" to a repo to which I do NOT have commit rights
Steps 2, 4, and 5b are the ones that I have difficulty with and I am sure that my current approach is suboptimal ;-)..
@smath I just submitted a pull request to your repo, just a couple of small changes. When I push/upload, the operation works, but when it switches back to Pythonista, a notification pops up saying that I have no such file in my library.
- andymitchhank
I have forked the wc_sync repo and made some updates to it to work with the Pythonista 2.0 beta. The sidebar view has not worked in the beta for a while now and some other changes have been made that made the original code unusable.
PS @Utsira - Working copy sends back the name of the updated file in the x-callback-url, so in turn Pythonista tries to open said file, which it thinks is in the root directory, since WC does not send back the repo name. I have accounted for this in my updates below.
@ahenry91 slight issue with the UI it doesn't appear to be responsive on my iPhone it is cut off slightly still usable though.
If you are happy to accept a pull request I might try and fix it tonight if someone doesn't beat me to it.
- andymitchhank
@shaun-h sorry, I beat you to the iPhone interface. If you would like to create a better interface, I'd be happy to accept the pull request.