Merge upstream.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 19 Jun 2008 15:45:18 +0000 (17:45 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 19 Jun 2008 15:45:18 +0000 (17:45 +0200)
1  2 
tests/__init__.py
tree.py
workingtree.py

index b8ba3d30011a9d95f26adbaf04e8427aa8e9f63a,9b6877d57d2359f0c7f1dc3c0312cb9b48ff6010..48204ad958cbe80e7d4c29870d0d19d61551b4fa
@@@ -84,10 -86,12 +84,9 @@@ class TestCaseWithSubversionRepository(
  
          return self.open_local_bzrdir(repos_url, relpath)
  
      def make_checkout(self, repos_url, relpath):
 -        rev = svn.core.svn_opt_revision_t()
 -        rev.kind = svn.core.svn_opt_revision_head
 -
 -        svn.client.checkout2(repos_url, relpath, 
 -                rev, rev, True, False, self.client_ctx)
 +        self.client_ctx.checkout(repos_url, relpath, "HEAD", "HEAD", 
 +                                 True, False)
  
      @staticmethod
      def create_checkout(branch, path, revision_id=None, lightweight=False):
diff --cc tree.py
Simple merge
diff --cc workingtree.py
index fd53dceb82a4a1bd9d9f50c5007617d9e6a2b3c0,06b6823f3905040b1e61b2841cdb0da0084db1c1..acbfcf6e375a61c22f9936f1eb3a80b038e859d4
@@@ -86,9 -79,13 +87,9 @@@ class SvnWorkingTree(WorkingTree)
          assert isinstance(self.basedir, unicode)
          self.bzrdir = bzrdir
          self._branch = branch
 -        self.base_revnum = 0
 -        self.client_ctx = create_svn_client(bzrdir.svn_url)
 -        self.client_ctx.log_msg_func2 = \
 -                svn.client.svn_swig_py_get_commit_log_func
 -
          self._get_wc()
-         (min_rev, max_rev, switch, modified) = wc.revision_status(self.basedir, None, True, None)
 -        max_rev = revision_status(self.basedir, None, True)[1]
++        (min_rev, max_rev, switch, modified) = revision_status(self.basedir, None, True, None)
 +        assert min_rev >= 0 and max_rev >= 0, "min rev: (%d, %d)" % (min_rev, max_rev)
          self.base_revnum = max_rev
          self.base_tree = SvnBasisTree(self)
          self.base_revid = branch.generate_revision_id(self.base_revnum)
          self._control_files = LockableFiles(control_transport, 'lock', LockDir)
  
      def get_ignore_list(self):
-         ignore_globs = set([wc.get_adm_dir()])
 -        ignores = set([get_adm_dir()])
 -        ignores.update(get_default_ignores(svn_config))
++        ignore_globs = set([get_adm_dir()])
 +        ignore_globs.update(ignores.get_runtime_ignores())
 +        ignore_globs.update(ignores.get_user_ignores())
  
-         def dir_add(adm, prefix, patprefix):
-             ignorestr = adm.prop_get(properties.PROP_IGNORE, 
+         def dir_add(wc, prefix, patprefix):
+             ignorestr = wc.prop_get(properties.PROP_IGNORE, 
                                      self.abspath(prefix).rstrip("/"))
              if ignorestr is not None:
                  for pat in ignorestr.splitlines():
 -                    ignores.add(urlutils.joinpath(patprefix, pat))
 +                    ignore_globs.add(urlutils.joinpath(patprefix, pat))
  
-             entries = adm.entries_read(False)
+             entries = wc.entries_read(False)
              for entry in entries:
                  if entry == "":
                      continue
                  finally:
                      subwc.close()
  
 -        wc = self._get_wc()
 +        adm = self._get_wc()
          try:
 -            dir_add(wc, "", ".")
 +            dir_add(adm, "", ".")
          finally:
-             adm.close()
+             wc.close()
  
 -        return ignores
 +        return ignore_globs
  
      def is_control_filename(self, path):
-         return wc.is_adm_dir(path)
+         return is_adm_dir(path)
  
      def apply_inventory_delta(self, changes):
          raise NotImplementedError(self.apply_inventory_delta)
                  # FIXME: Generate more random file ids
                  return ("NEW-" + escape_svn_path(entry.url[len(entry.repos):].strip("/")), None)
  
 -        def add_dir_to_inv(relpath, wc, parent_id):
 +        def add_dir_to_inv(relpath, adm, parent_id):
              assert isinstance(relpath, unicode)
-             entries = adm.entries_read(False)
+             entries = wc.entries_read(False)
              entry = entries[""]
              assert parent_id is None or isinstance(parent_id, str), \
                      "%r is not a string" % parent_id
                      subwc.close()
  
          # Set proper version for all files in the wc
-         adm = self._get_wc(write_lock=True)
+         wc = self._get_wc(write_lock=True)
          try:
-             update_settings(adm, "")
+             update_settings(wc, "")
          finally:
-             adm.close()
+             wc.close()
          self.base_revid = revid
  
 -    def commit(self, message=None, message_callback=None, revprops=None, 
 -               timestamp=None, timezone=None, committer=None, rev_id=None, 
 -               allow_pointless=True, strict=False, verbose=False, local=False, 
 -               reporter=None, config=None, specific_files=None, author=None):
 -        if author is not None:
 -            revprops['author'] = author
 -        # FIXME: Use allow_pointless
 -        # FIXME: Use verbose
 -        # FIXME: Use reporter
 -        # FIXME: Use strict
 -        if local:
 -            raise LocalCommitsUnsupported()
 -
 -        if specific_files:
 -            specific_files = [self.abspath(x).encode('utf8') for x in specific_files]
 -        else:
 -            specific_files = [self.basedir.encode('utf8')]
 -
 -        if message_callback is not None:
 -            def log_message_func(items, pool):
 -                """ Simple log message provider for unit tests. """
 -                return message_callback(self).encode("utf-8")
 -        else:
 -            assert isinstance(message, basestring)
 -            def log_message_func(items, pool):
 -                """ Simple log message provider for unit tests. """
 -                return message.encode("utf-8")
 -
 -        self.client_ctx.log_msg_baton2 = log_message_func
 -        if rev_id is not None:
 -            extra = "%d %s\n" % (self.branch.revno()+1, rev_id)
 -        else:
 -            extra = ""
 -        wc = self._get_wc(write_lock=True)
 -        try:
 -            wc.prop_set(SVN_PROP_BZR_REVISION_ID+str(self.branch.mapping.scheme), 
 -                             self._get_bzr_revids(self._get_base_branch_props()) + extra,
 -                             self.basedir)
 -            wc.prop_set(SVN_PROP_BZR_REVISION_INFO, 
 -                             generate_revision_metadata(timestamp, 
 -                                                        timezone, 
 -                                                        committer,
 -                                                        revprops),
 -                             self.basedir)
 -        finally:
 -            wc.close()
 -
 -        try:
 -            try:
 -                commit_info = svn.client.commit3(specific_files, True, False, 
 -                                                 self.client_ctx)
 -            except SubversionException, (_, num):
 -                if num == ERR_FS_TXN_OUT_OF_DATE:
 -                    raise OutOfDateTree(self)
 -                raise
 -        except:
 -            # Reset properties so the next subversion commit won't 
 -            # accidently set these properties.
 -            wc = self._get_wc(write_lock=True)
 -            base_branch_props = self._get_base_branch_props()
 -            wc.prop_set(SVN_PROP_BZR_REVISION_ID+str(self.branch.mapping.scheme), 
 -                             self._get_bzr_revids(base_branch_props), self.basedir)
 -            wc.prop_set(SVN_PROP_BZR_REVISION_INFO, 
 -                              base_branch_props.get(SVN_PROP_BZR_REVISION_INFO, ""),
 -                              self.basedir)
 -            wc.close()
 -            raise
 -
 -        self.client_ctx.log_msg_baton2 = None
 -
 -        revid = self.branch.generate_revision_id(commit_info.revision)
 -
 -        self.base_revid = revid
 -        self.base_revnum = commit_info.revision
 -        self.base_tree = SvnBasisTree(self)
 -
 -        return revid
 -
      def smart_add(self, file_list, recurse=True, action=None, save=True):
          assert isinstance(recurse, bool)
          if action is None:
              ids = iter(ids)
          assert isinstance(files, list)
          for f in files:
 -            wc = self._get_wc(os.path.dirname(f), write_lock=True)
 +            adm = self._get_wc(os.path.dirname(f), write_lock=True)
              try:
                  try:
-                     adm.add(os.path.join(self.basedir, f))
+                     wc.add(os.path.join(self.basedir, f))
                      if ids is not None:
 -                        self._change_fileid_mapping(ids.next(), f, wc)
 +                        self._change_fileid_mapping(ids.next(), f, adm)
                  except SubversionException, (_, num):
                      if num == ERR_ENTRY_EXISTS:
                          continue
          return self.branch.repository.branchprop_list.get_properties(
                  self.branch.get_branch_path(self.base_revnum), self.base_revnum)
  
 -    def _get_new_file_ids(self, wc):
 +    def _get_new_file_ids(self, adm):
          committed = self._get_base_branch_props().get(SVN_PROP_BZR_FILEIDS, "")
-         existing = adm.prop_get(SVN_PROP_BZR_FILEIDS, self.basedir)
+         existing = wc.prop_get(SVN_PROP_BZR_FILEIDS, self.basedir)
          if existing is None or committed == existing:
              return {}
          return dict(map(lambda x: str(x).split("\t"), 
  
      def pending_merges(self):
          merged = self._get_bzr_merges(self._get_base_branch_props()).splitlines()
 -        wc = self._get_wc()
 +        adm = self._get_wc()
          try:
-             merged_data = adm.prop_get(
+             merged_data = wc.prop_get(
                  SVN_PROP_BZR_ANCESTRY+str(self.branch.mapping.scheme), self.basedir)
              if merged_data is None:
                  set_merged = []
@@@ -697,14 -726,11 +698,14 @@@ class SvnCheckout(BzrDir)
          self.local_path = transport.local_abspath(".")
          
          # Open related remote repository + branch
 -        wc = WorkingCopy(None, self.local_path)
          try:
-             adm = wc.WorkingCopy(None, self.local_path)
 -            self.svn_url = wc.entry(self.local_path, True).url
++            wc = WorkingCopy(None, self.local_path)
 +        except SubversionException, (msg, ERR_WC_UNSUPPORTED_FORMAT):
 +            raise UnsupportedFormatError(msg, kind='workingtree')
 +        try:
 +            self.svn_url = adm.entry(self.local_path, True).url
          finally:
-             adm.close()
+             wc.close()
  
          self.remote_transport = SvnRaTransport(self.svn_url)
          self.remote_bzrdir = SvnRemoteAccess(self.remote_transport)