Mercurial WebDAV provider


This screenshot shows how a Mercurial repository appears in Microsoft Windows File Explorer:


Some new live properties are available:




This is not production code.

To publish a Mercurial repository by the share name ‘hg’, simply add thes lines to the configuration file:

# Publish a Mercurial repository
from wsgidav.samples.hg_dav_provider import HgResourceProvider
addShare("hg", HgResourceProvider("REPO_PATH_OR_URL"))


DAV provider that publishes a Mercurial repository.

Note: This is not production code!

The repository is rendered as three top level collections.

Contains the working directory, i.e. all files. This includes uncommitted changes and untracked new files. This folder is writable.
Contains the latest committed files, also known as ‘tip’. This folder is read-only.
Contains the last 10 revisions as sub-folders. This folder is read-only.

Sample layout:


Supported features:

  1. Copying or moving files from /edit/.. to the /edit/.. folder will result in a hg copy or hg rename.
  2. Deleting resources from /edit/.. will result in a hg remove.
  3. Copying or moving files from /edit/.. to the /released folder will result in a hg commit. Note that the destination path is ignored, instead the source path is used. So a user can drag a file or folder from somewhere under the edit/.. directory and drop it directly on the released directory to commit changes.
  4. To commit all changes, simply drag’n’drop the /edit folder on the /released folder.
  5. Creating new collections results in creation of a file called .directory, which is then hg add ed since Mercurial doesn’t track directories.
  6. Some attributes are published as live properties, such as {hg:}date.

Known limitations:

  1. This ‘commit by drag-and-drop’ only works, if the WebDAV clients produces MOVE or COPY requests. Alas, some clients will send PUT, MKCOL, … sequences instead.
  2. Adding and then removing a file without committing after the ‘add’ will leave this file on disk (untracked) This happens for example whit lock files that Open Office Write and other applications will create.
  3. Dragging the ‘edit’ folder onto ‘released’ with Windows File Explorer will remove the folder in the explorer view, although WsgiDAV did not delete it. This seems to be done by the client.
easy_install mercurial or install the API as non-standalone version from here: