changeset 25692:9f6e0e7ef828

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.
author Augie Fackler <augie@google.com>
date Mon, 29 Jun 2015 17:10:36 -0400
parents 5cda0ce05c42
children a6c1eac2fb1e
files mercurial/sshserver.py tests/test-hup.t
diffstat 2 files changed, 1 insertions(+), 75 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/sshserver.py	Mon Jun 29 12:35:31 2015 -0400
+++ b/mercurial/sshserver.py	Mon Jun 29 17:10:36 2015 -0400
@@ -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 @@
             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
--- a/tests/test-hup.t	Mon Jun 29 12:35:31 2015 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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