# HG changeset patch # User Augie Fackler # Date 2015-06-29 21:10:36 # Node ID 9f6e0e7ef82884e3ec66455dac7312820c2b35ce # Parent 5cda0ce05c42bab5882f64fe186884e3eca7a1f5 sshserver: drop ancient do_{lock,unlock,addchangegroup} methods These were marked as deprecated and dangerous way back in e8c4f3d3df8c, which was first included in Mercurial 0.9.1. While it's possible that clients from that long ago are still around somewhere, they're risky for servers in that they want to lock the repo, and then might leave it locked if they died before finishing their transaction. Given that it's been 9 years, let's go ahead and cut this last lingering tie with a basically-untested protocol. diff --git a/mercurial/sshserver.py b/mercurial/sshserver.py --- a/mercurial/sshserver.py +++ b/mercurial/sshserver.py @@ -6,7 +6,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -import util, hook, wireproto, changegroup +import util, hook, wireproto import os, sys class sshserver(wireproto.abstractserverproto): @@ -120,33 +120,6 @@ class sshserver(wireproto.abstractserver else: self.sendresponse("") return cmd != '' - def do_lock(self): - '''DEPRECATED - allowing remote client to lock repo is not safe''' - - self.lock = self.repo.lock() - return "" - - def do_unlock(self): - '''DEPRECATED''' - - if self.lock: - self.lock.release() - self.lock = None - return "" - - def do_addchangegroup(self): - '''DEPRECATED''' - - if not self.lock: - self.sendresponse("not locked") - return - - self.sendresponse("") - cg = changegroup.cg1unpacker(self.fin, "UN") - r = changegroup.addchangegroup(self.repo, cg, 'serve', self._client()) - self.lock.release() - return str(r) - def _client(self): client = os.environ.get('SSH_CLIENT', '').split(' ', 1)[0] return 'remote:ssh:' + client diff --git a/tests/test-hup.t b/tests/test-hup.t deleted file mode 100644 --- a/tests/test-hup.t +++ /dev/null @@ -1,47 +0,0 @@ -#require serve fifo - -Test hangup signal in the middle of transaction - - $ hg init - $ mkfifo p - $ hg serve --stdio < p 1>out 2>&1 & - $ P=$! - -Do test while holding fifo open - - $ ( - > echo lock - > echo addchangegroup - > start=`date +%s` - > # 10 second seems much enough to let the server catch up - > deadline=`expr $start + 10` - > while [ ! -s .hg/store/journal ]; do - > sleep 0; - > if [ `date +%s` -gt $deadline ]; then - > echo "transaction did not start after 10 seconds" >&2; - > exit 1; - > fi - > done - > kill -HUP $P - > ) > p - - $ wait - $ cat out - 0 - 0 - adding changesets - transaction abort! - rollback completed - killed! - - $ ls -1d .hg/* .hg/store/* - .hg/00changelog.i - .hg/journal.bookmarks - .hg/journal.branch - .hg/journal.desc - .hg/journal.dirstate - .hg/requires - .hg/store - .hg/store/00changelog.i - .hg/store/00changelog.i.a - .hg/store/journal.phaseroots