X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/352b8591bd1c7163835a6fa1db34d3e2861c1071..aac18e2d101a237381f92ff26557286e623a4a22:/lib/wlrepo/__init__.py?ds=inline diff --git a/lib/wlrepo/__init__.py b/lib/wlrepo/__init__.py index cbc0c2c6..ab6f319f 100644 --- a/lib/wlrepo/__init__.py +++ b/lib/wlrepo/__init__.py @@ -108,7 +108,21 @@ class LibraryException(Exception): class RevisionNotFound(LibraryException): def __init__(self, rev): LibraryException.__init__(self, "Revision %r not found." % rev) + +class EntryNotFound(LibraryException): + def __init__(self, rev, entry, guesses=[]): + LibraryException.__init__(self, \ + u"Entry '%s' at revision %r not found. %s" % (entry, rev, \ + (u"Posible values:\n" + u',\n'.join(guesses)) if len(guesses) else u'') ) + +class DocumentAlreadyExists(LibraryException): pass # import backends to local namespace -from mercurial_backend.library import MercurialLibrary \ No newline at end of file + +def open_library(path, proto, *args, **kwargs): + if proto == 'hg': + import wlrepo.mercurial_backend + return wlrepo.mercurial_backend.MercurialLibrary(path, *args, **kwargs) + + raise NotImplemented() \ No newline at end of file