Beispiel #1
0
    def test_crawl_revisions2(self):
        infos = []
        set_paths = []

        def notify(info, pool):
            infos.append(info)

        class MyReporter:
            def __init__(self):
                self._finished_report = False

            def abort_report(self, pool):
                pass

            def finish_report(self, pool):
                self._finished_report = True

            def set_path(self, path, revision, start_empty, lock_token, pool):
                set_paths.append(path)

            def link_path(self, path, url, revision, start_empty, lock_token,
                          pool):
                pass

            def delete_path(self, path, pool):
                pass

        # Remove trunk/README.txt
        readme_path = '%s/trunk/README.txt' % self.path
        self.assert_(os.path.exists(readme_path))
        os.remove(readme_path)

        # Restore trunk/README.txt using crawl_revision2
        info = wc.init_traversal_info()
        reporter = MyReporter()
        wc.crawl_revisions2(self.path, self.wc, reporter, True, True, False,
                            notify, info)

        # Check that the report finished
        self.assert_(reporter._finished_report)
        self.assertEqual([''], set_paths)
        self.assertEqual(1, len(infos))

        # Check content of infos object
        [info] = infos
        self.assertEqual(readme_path, info.path)
        self.assertEqual(core.svn_node_file, info.kind)
        self.assertEqual(core.SVN_INVALID_REVNUM, info.revision)
Beispiel #2
0
  def test_crawl_revisions2(self):
      infos = []
      set_paths = []

      def notify(info, pool):
          infos.append(info)

      class MyReporter:
          def __init__(self):
              self.finished_report = False

          def abort_report(self, pool):
              pass

          def finish_report(self, pool):
              self.finished_report = True

          def set_path(self, path, revision, start_empty, lock_token, pool):
              set_paths.append(path)

          def link_path(self, path, url, revision, start_empty, lock_token,
                        pool):
              pass

          def delete_path(self, path, pool):
              pass

      # Remove trunk/README.txt
      readme_path = '%s/trunk/README.txt' % self.path
      self.assert_(os.path.exists(readme_path))
      os.remove(readme_path)

      # Restore trunk/README.txt using crawl_revision2
      info = wc.init_traversal_info()
      reporter = MyReporter()
      wc.crawl_revisions2(self.path, self.wc, reporter,
                          True, True, False, notify, info)

      # Check that the report finished
      self.assert_(reporter.finished_report)
      self.assertEqual([''], set_paths)
      self.assertEqual(1, len(infos))

      # Check content of infos object
      [info] = infos
      self.assertEqual(readme_path, info.path)
      self.assertEqual(core.svn_node_file, info.kind)
      self.assertEqual(core.SVN_INVALID_REVNUM, info.revision)
Beispiel #3
0
 def test_init_traversal_info(self):
     wc.init_traversal_info()
Beispiel #4
0
 def test_init_traversal_info(self):
     wc.init_traversal_info()