Mercurial > hg > hgforest
changeset 111:b3aa740a13f8
Fix fclone on 1.7 servers.
author | Michael Tharp <mtharp@rpath.com> |
---|---|
date | Wed, 05 Jan 2011 11:29:08 -0500 |
parents | 18897318f6e1 |
children | bf6d44054cec |
files | forest.py |
diffstat | 1 files changed, 21 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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))