# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+"""Checkouts and working trees (working copies)."""
from bzrlib.branch import PullResult
from bzrlib.bzrdir import BzrDirFormat, BzrDir
from branch import SvnBranch
from convert import SvnConverter
-from repository import (SvnRepository, escape_svn_path, SVN_PROP_BZR_MERGE,
+from repository import (SvnRepository, SVN_PROP_BZR_MERGE,
SVN_PROP_SVK_MERGE, SVN_PROP_BZR_FILEIDS,
revision_id_to_svk_feature)
+from revids import escape_svn_path
from scheme import BranchingScheme
from transport import (SvnRaTransport, svn_config, bzr_to_svn_url,
_create_auth_baton)
class SvnWorkingTree(WorkingTree):
- """Implementation of WorkingTree that uses a Subversion
- Working Copy for storage."""
+ """WorkingTree implementation that uses a Subversion Working Copy for storage."""
def __init__(self, bzrdir, local_path, branch):
self._format = SvnWorkingTreeFormat()
self.basedir = local_path
(_, rp) = self.branch.repository.scheme.unprefix(path)
entry = self.base_tree.id_map[rp]
assert entry[0] is not None
+ assert isinstance(entry[0], str), "fileid %r for %r is not a string" % (entry[0], path)
return entry
def read_working_inventory(self):
if id is None:
mutter('no id for %r' % entry.url)
return
+ assert revid is None or isinstance(revid, str), "%r is not a string" % revid
assert isinstance(id, str), "%r is not a string" % id
# First handle directory itself
self.base_tree = RevisionTree(self, Inventory(), revid)
return
- (bp, rev) = self.branch.repository.parse_revision_id(revid)
- assert bp == self.branch.branch_path
+ rev = self.branch.lookup_revision_id(revid)
self.base_revnum = rev
self.base_revid = revid
self.base_tree = SvnBasisTree(self)
def update_settings(wc, path):
id = newrevtree.inventory.path2id(path)
mutter("Updating settings for %r" % id)
- (_, revnum) = self.branch.repository.parse_revision_id(
+ revnum = self.branch.lookup_revision_id(
newrevtree.inventory[id].revision)
svn.wc.process_committed2(self.abspath(path).rstrip("/"), wc,
stop_revision = self.branch.last_revision()
rev = svn.core.svn_opt_revision_t()
rev.kind = svn.core.svn_opt_revision_number
- rev.value.number = self.branch.repository.parse_revision_id(stop_revision)[1]
+ rev.value.number = self.branch.lookup_revision_id(stop_revision)
fetched = svn.client.update(self.basedir, rev, True, self.client_ctx)
self.base_revid = self.branch.repository.generate_revision_id(fetched, self.branch.branch_path)
result.new_revid = self.branch.generate_revision_id(fetched)
if new_entries.has_key(path):
del new_entries[path]
else:
+ assert isinstance(id, str)
new_entries[path] = id
committed = self.branch.repository.branchprop_list.get_property(
self.branch.branch_path,
def _get_new_file_ids(self, wc):
committed = self.branch.repository.branchprop_list.get_property(
- self.branch.branch_path,
- self.base_revnum,
+ self.branch.branch_path, self.base_revnum,
SVN_PROP_BZR_FILEIDS, "")
existing = svn.wc.prop_get(SVN_PROP_BZR_FILEIDS, self.basedir, wc)
if existing is None:
return {}
else:
- return dict(map(lambda x: x.split("\t"), existing[len(committed):].splitlines()))
+ return dict(map(lambda x: str(x).split("\t"),
+ existing[len(committed):].splitlines()))
def _get_bzr_merges(self):
return self.branch.repository.branchprop_list.get_property(
- self.branch.branch_path,
- self.base_revnum,
+ self.branch.branch_path, self.base_revnum,
SVN_PROP_BZR_MERGE, "")
def _get_svk_merges(self):
return self.branch.repository.branchprop_list.get_property(
- self.branch.branch_path,
- self.base_revnum,
+ self.branch.branch_path, self.base_revnum,
SVN_PROP_SVK_MERGE, "")
def set_pending_merges(self, merges):
class SvnWorkingTreeFormat(WorkingTreeFormat):
+ """Subversion working copy format."""
def get_format_description(self):
return "Subversion Working Copy"
def clone(self, path, revision_id=None, force_new_repo=False):
raise NotImplementedError(self.clone)
- def open_workingtree(self, _unsupported=False):
+ def open_workingtree(self, _unsupported=False, recommend_upgrade=False):
return SvnWorkingTree(self, self.local_path, self.open_branch())
def sprout(self, url, revision_id=None, force_new_repo=False,