mercurial/sshrepo.py
changeset 1357 94586af53d2f
parent 1332 404484c9628e
child 1358 20abfd48e21c
equal deleted inserted replaced
1356:ec1895e297f7 1357:94586af53d2f
     6 # of the GNU General Public License, incorporated herein by reference.
     6 # of the GNU General Public License, incorporated herein by reference.
     7 
     7 
     8 from node import *
     8 from node import *
     9 from remoterepo import *
     9 from remoterepo import *
    10 from demandload import *
    10 from demandload import *
    11 demandload(globals(), "hg os re select")
    11 demandload(globals(), "hg os re stat")
    12 
    12 
    13 class sshrepository(remoterepository):
    13 class sshrepository(remoterepository):
    14     def __init__(self, ui, path):
    14     def __init__(self, ui, path):
    15         self.url = path
    15         self.url = path
    16         self.ui = ui
    16         self.ui = ui
    35         ui.note('running %s\n' % cmd)
    35         ui.note('running %s\n' % cmd)
    36         self.pipeo, self.pipei, self.pipee = os.popen3(cmd, 'b')
    36         self.pipeo, self.pipei, self.pipee = os.popen3(cmd, 'b')
    37 
    37 
    38     def readerr(self):
    38     def readerr(self):
    39         while 1:
    39         while 1:
    40             r,w,x = select.select([self.pipee], [], [], 0)
    40             size = os.fstat(self.pipee.fileno())[stat.ST_SIZE]
    41             if not r: break
    41             if size == 0: break
    42             l = self.pipee.readline()
    42             l = self.pipee.readline()
    43             if not l: break
    43             if not l: break
    44             self.ui.status("remote: ", l)
    44             self.ui.status("remote: ", l)
    45 
    45 
    46     def __del__(self):
    46     def __del__(self):
    47         try:
    47         try:
    48             self.pipeo.close()
    48             self.pipeo.close()
    49             self.pipei.close()
    49             self.pipei.close()
    50             for l in self.pipee:
    50             readerr()
    51                 self.ui.status("remote: ", l)
       
    52             self.pipee.close()
    51             self.pipee.close()
    53         except:
    52         except:
    54             pass
    53             pass
    55 
    54 
    56     def dev(self):
    55     def dev(self):