# HG changeset patch # User Michael Tharp # Date 1294244948 18000 # Node ID b3aa740a13f81c500061dbe458e33f2b56f56a96 # Parent 18897318f6e115827f81a72c88d43a7aa09d6d84 Fix fclone on 1.7 servers. diff -r 18897318f6e1 -r b3aa740a13f8 forest.py --- a/forest.py Fri Dec 03 14:02:18 2010 -0500 +++ b/forest.py Wed Jan 05 11:29:08 2011 -0500 @@ -262,12 +262,32 @@ sshserver.sshserver.do_hello = _sshserver_do_hello +try: + from mercurial import wireproto +except KeyError: + pass +else: + # hg >= 1.7 + _old_caps = wireproto.capabilities + def _forest_caps(*args, **kwargs): + caps = _old_caps(*args, **kwargs) + caps += ' forests' + return caps + wireproto.capabilities = _forest_caps + + def do_forests(repo, proto, walkhg): + forests = repo.forests(bool(walkhg)) + return "\n".join(forests) + wireproto.commands['forests'] = (do_forests, 'walkhg') + + + def _sshserver_do_forests(self): """Shim this function into the sshserver so that it responds to the forests command. It gives a list of roots relative to the self.repo repository, sorted lexigraphically. """ - + # hg < 1.7 key, walkhg = self.getarg() forests = self.repo.forests(bool(walkhg)) self.respond("\n".join(forests))