Menu

dav-sync push doesn't upload missing files on server

dAF2000
2018-07-11
2018-07-11
  • dAF2000

    dAF2000 - 2018-07-11

    I think I've found a bug (or feature depending on how you look at it).
    It's easy to reproduce:

    • create a repository and directory and push all local files to the
      webdav server using "dav-sync push". All is fine.
    • remove a file from the webdav server.
    • execute dav-sync push again. It reports no files have been uploaded,
      but still the webdav server is missing one.
    • remove a directory from the webdav server.
    • execute dav-sync push again. Only the directory is created using
      "mkcol" but the files in the directory are not synced.

    Of course dav-sync syncs the LOCAL changes to the server and in this
    example there are no local changes. But if you just want the webdav
    server be a copy of a local directory, this cannot work. So, I only
    would like a sync from local to remote (one direction) and if for what
    reason a file is missing on the server it should be uploaded again.

    Greets,
    David

     
  • Pyrphoros

    Pyrphoros - 2018-07-11

    This behavior is intentional, because dav-sync is designed for a bidirectional sync and you may want to sync the file deletion. So in this case, after the file is removed from the server, dav-sync pull will delete the file locally.

    Therefore what you want is a missing feature. The actual bug is that directories are recreated on the server.

    But I just added some options for the push command that allow you to restore missing files on the server.

    dav-sync push -R <dir>
    

    This will not only upload all locally changed files, but also files, that are missing on the server.

    dav-sync push -M <dir>
    

    With this option, files that are modified on the server will be replaced with the local version.

    Of course you can combine both options to ensure the server has always the same files as the client.

    To use the new features, you need the latest source code from the hg repository. I hope this helps.

     

    Last edit: Pyrphoros 2018-07-11
  • dAF2000

    dAF2000 - 2018-07-11

    Thanks a lot.
    I just tested it and the -R and -M options seem to work fine. The "mkcol bug" is still there but you didn't fix that yet, I assume.

    I use your tool because of the unidirectional sync so this really a good enhancement.

     
  • Pyrphoros

    Pyrphoros - 2018-07-11

    I still don't know in which case dav-sync doesn't create the directory before the file is uploaded, but it doesn't matter because I added the check for the 404 status code. The problem shouldn't occur from now on.

     
  • dAF2000

    dAF2000 - 2018-07-11

    I meant the mkcol bug in this discussion: if you remove a directory on the server, dav-sync recreates it again (without any content). For me it's no problem because I will use -R and -M but it's not about me here ;)

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.