[Share Code] Tool to synchronize with a WebDav serverbrowsing

Since I wanted to synchronize my Pythonista files with my project on GitHub I installed the iOS app "working copy" and use my little tool "gitsynchista" to move files back and forth between the local Pythonista directory tree and the WebDav server offered by "working copy".

The general approach is to synch one directory tree on the WebDav server with one directory tree on Pythonista. So for example if your local directory is localdir and the remote directory on the WebDav server is /remotedir you would have one configuration file

Thanks. I have found the conf file in /etc. I would recommend placing that information in the readme file as well.

I have also found the WebDav settings in Working Copy, and copied the credentials to the configuration file. But all I am getting is 401 Unauthorized. Possibly related to that I do not know what the remote directory should be. Is it just the local repository name in Working Copy?

Mikael, I would suggest you set the access scope of "working copy" to localhost and try to access the repository without authentication. I remember that I had trouble when I started using the easywebdav library and was quite frustated that it did not work for me in the beginning. I guess I disabled authentication at some point along the way and so far haven't tried to reactivate it. If deactivating authentication works for you maybe we should send a note to the maintainer of the library and ask for advice.

Browsing through the log file I cannot see an obvious errors. You seem to have a directory /MarkdownView/.git on the WebDav server which is not in your local file system yet. So all files in that directory tree end up in the the list "Remote new files". However, not a single file is transferred. My suspicion is that this is somehow related to the fact that you try to synchronize a "." (dot) directory. In my script there is a default ignore pattern for dot-files which is apparently in your case not activated since I made a coding error: the default ignore pattern is only added to the list if there is a local ignore file defined which is does seem to be the case in your configuration.

I introduced this ignore pattern since there's currently a limitation in the "working copy" app when it comes to dot files: they cannot be transferred. However, as I can see in your example this does not seem to apply to dot directories, so my pattern is too general. I will try if I can successfully transfer a dot directory and make fixes for that if required.

The real questions, however, is: Why would you want to transfer anything in your .git sub directory? My understanding is that normally this directory only contains technical control files denoting the state of your git project which are better left alone. So far I have used my script to synchronize with three git repositories using "working copy" and in none of them the directory '.git' was visible in the WebDav server at all which is exactly what I would expect from a git client: keeping the scary details away from me. How exactly did you bring all these files into the "working copy" app? Did you do anything else besides "cloning" the git project?

Take a look at my clone https://github.com/marcus67/pythonista-markdownview. It contains a working configuration file in the etc subdirectory. You may want to change the name of the local directory. The name of remote directory is basically set by the cloning step in "working copy" since the app uses the project name in GitHub as base directory.

Apparently, your version of "working copy" returned the dot directory ".git" before my version did (it does now). So, at first I could not reproduce the error. The new version of my app is able to handle the .git subdirectory. It is simply suppressed automatically.

Hmm I'm unable to get it to work with my working copy. Idk why it's still getting its access denied. Should probably import from easywebdav instead of forcing the user to slap the client file outside if the folder.

There's an issue with authentification in the easywebdav module. If you are using the tool locally, try to switch the WebDav server to localhost and remove user and password both in working copy and in gitsynchista. Then, try again.

@miwagner1 : Glad you like it. By the way: I'm working on a simple GUI for pythonista which lets you pick the application to sync and see a preview of which files will be synched. I'm still having a little trouble with the x-url-callbacks of Working Copy but, in general, it works. I'll write a post when I think that it can be used by others.

Working Copy always displaying an empty repositories list when I run the script, takes a long moment and is of no apparent value to me. Plus always turns the WebDav server off so that I have to go and turn it on a second time. Probably related to the callbacks you are working on.

I am not able to provide an argument to the script (Pythonista is not saving the argument for some reason).

I will be looking at this delay you experience when doing x-callback-url commands. I have heard about this before and it should not be that way.

When Working Copy is put in the background it will only be allowed to run for a little while before being put to sleep by iOS and then the WebDAV server shuts down as well. Could this be what you experience?

@palmin : It was me who wrote you mail about the blocking x-url-callbacks about two days ago. :-) If I have time tonight I will try with the latest versions of both Pythonista and Working Copy and send you a more detailed description of the phenomenon.