wsgidav.samples.hg_dav_provider#

Description

DAV provider that publishes a Mercurial repository.

Note: This is not production code!

The repository is rendered as three top level collections.

edit:

Contains the working directory, i.e. all files. This includes uncommitted changes and untracked new files. This folder is writable.

released:

Contains the latest committed files, also known as ‘tip’. This folder is read-only.

archive:

Contains the last 10 revisions as sub-folders. This folder is read-only.

Sample layout:

/<share>/
    edit/
        server/
            ext_server.py
        README.txt
    released/
    archive/
        19/
        18/
        ...

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.

See:

http://mercurial.selenic.com/wiki/MercurialApi

Requirements:

easy_install mercurial or install the API as non-standalone version from here: http://mercurial.berkwood.com/ http://mercurial.berkwood.com/binaries/mercurial-1.4.win32-py2.6.exe

Classes

HgResource(path, is_collection, environ, ...)

Abstract base class for all resources.

HgResourceProvider(repoRoot)

DAV provider that serves a VirtualResource derived structure.

Other Members

BUFFER_SIZE

int([x]) -> integer int(x, base=10) -> integer

HTTP_FORBIDDEN

int([x]) -> integer int(x, base=10) -> integer