~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/ftp.py

  • Committer: Vincent Ladeuil
  • Date: 2007-05-25 14:41:42 UTC
  • mto: (2485.8.44 bzr.connection.sharing)
  • mto: This revision was merged to the branch mainline in revision 2646.
  • Revision ID: v.ladeuil+lp@free.fr-20070525144142-wp4vof8hjjn3g9zx
Fix the 'FtpServer' so that it can handle full bzr commands.

* bzrlib/transport/ftp.py:
(FtpServer.setUp): Allows for 10000 requests instead of 1000 or
the server dies peacefully and so quietly that the client still
waits for him to asnswer the requests.
(FtpServer._asyncore_loop_ignore_EBADF): Add a FIXME waiting for
more understanding no how to report the problem.

* bzrlib/tests/commands/test_branch.py:
(TestBranch): Tests combinations of local and remote branches.

* bzrlib/tests/commands/__init__.py:
(test_suite): Add test_push.

* bzrlib/tests/commands/test_push.py: 
New file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
        self.is_active = base.startswith('aftp://')
110
110
        if self.is_active:
111
111
            # urlparse won't handle aftp://, delete the leading 'a'
112
 
 
113
112
            # FIXME: This breaks even hopes of connection sharing
114
113
            # (by reusing the url instead of true cloning) by
115
114
            # modifying the the url coming from the user.
603
602
        # In this case it will run for 100s, or 1000 requests
604
603
        self._async_thread = threading.Thread(
605
604
                target=FtpServer._asyncore_loop_ignore_EBADF,
606
 
                kwargs={'timeout':0.1, 'count':1000})
 
605
                kwargs={'timeout':0.1, 'count':10000})
607
606
        self._async_thread.setDaemon(True)
608
607
        self._async_thread.start()
609
608
 
623
622
        """
624
623
        try:
625
624
            asyncore.loop(*args, **kwargs)
 
625
            # FIXME: If we reach that point, we should raise an
 
626
            # exception explaining that the 'count' parameter in
 
627
            # setUp is too low or testers may wonder why their
 
628
            # test just sits there waiting for a server that is
 
629
            # already dead.
626
630
        except select.error, e:
627
631
            if e.args[0] != errno.EBADF:
628
632
                raise
674
678
        def log(self, message):
675
679
            """Redirect logging requests."""
676
680
            mutter('_ftp_channel: %s', message)
677
 
            
 
681
 
678
682
        def log_info(self, message, type='info'):
679
683
            """Redirect logging requests."""
680
684
            mutter('_ftp_channel %s: %s', type, message)
681
 
            
 
685
 
682
686
        def cmd_rnfr(self, line):
683
687
            """Prepare for renaming a file."""
684
688
            self._renaming = line[1]