hgext/largefiles/wirestore.py
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
Fri, 13 Jan 2012 22:16:01 +0100
changeset 15893 eb6867b98223
parent 15252 6e809bb4f969
child 16686 67964cda8701
permissions -rw-r--r--
discovery: fix prepush documentation The prepush documentation claim that when we refuse to push, the second element of the returng tuple is an "outgoing" integer. value should be 0 when no outgoing changeset and 1 otherwise. In pratice if there are no outgoing changeset, "outgoing" value is alway 1 and util.Abort is raised on other error. the stable branch also include this error so it wasn't introduced by a recent refactoring.

# Copyright 2010-2011 Fog Creek Software
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.

'''largefile store working over Mercurial's wire protocol'''

import lfutil
import remotestore

class wirestore(remotestore.remotestore):
    def __init__(self, ui, repo, remote):
        cap = remote.capable('largefiles')
        if not cap:
            raise lfutil.storeprotonotcapable([])
        storetypes = cap.split(',')
        if not 'serve' in storetypes:
            raise lfutil.storeprotonotcapable(storetypes)
        self.remote = remote
        super(wirestore, self).__init__(ui, repo, remote.url())

    def _put(self, hash, fd):
        return self.remote.putlfile(hash, fd)

    def _get(self, hash):
        return self.remote.getlfile(hash)

    def _stat(self, hash):
        return self.remote.statlfile(hash)