Mercurial > hgsubversion
changeset 420:59e19c73b0df
svnmeta: eliminate unneeded path_and_branch_for_path() method
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Thu, 11 Jun 2009 19:10:05 +0200 |
parents | 3ed71e63f64c |
children | 8277113036f1 |
files | hgsubversion/hg_delta_editor.py hgsubversion/svnmeta.py |
diffstat | 2 files changed, 12 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/hg_delta_editor.py +++ b/hgsubversion/hg_delta_editor.py @@ -148,7 +148,7 @@ class HgChangeReceiver(delta.Editor): for f in files_to_commit: if not self.meta.is_path_valid(f): continue - p, b = self.meta.path_and_branch_for_path(f) + p, b = self.meta.split_branch_path(f)[:2] if b not in branch_batches: branch_batches[b] = [] branch_batches[b].append((p, f)) @@ -265,7 +265,7 @@ class HgChangeReceiver(delta.Editor): @ieditor def delete_entry(self, path, revision_bogus, parent_baton, pool=None): - br_path, branch = self.meta.path_and_branch_for_path(path) + br_path, branch = self.meta.split_branch_path(path)[:2] if br_path == '': self.meta.closebranches.add(branch) if br_path is not None: @@ -290,7 +290,7 @@ class HgChangeReceiver(delta.Editor): @ieditor def open_file(self, path, parent_baton, base_revision, p=None): self.current.file = None - fpath, branch = self.meta.path_and_branch_for_path(path) + fpath, branch = self.meta.split_branch_path(path)[:2] if not fpath: self.ui.debug('WARNING: Opening non-existant file %s\n' % path) return @@ -330,7 +330,7 @@ class HgChangeReceiver(delta.Editor): self.current.base = None if path in self.current.deleted: del self.current.deleted[path] - fpath, branch = self.meta.path_and_branch_for_path(path, existing=False) + fpath, branch = self.meta.split_branch_path(path, existing=False)[:2] if not fpath: return if branch not in self.meta.branches: @@ -343,7 +343,7 @@ class HgChangeReceiver(delta.Editor): return self.ui.note('A+ %s\n' % path) (from_file, - from_branch) = self.meta.path_and_branch_for_path(copyfrom_path) + from_branch) = self.meta.split_branch_path(copyfrom_path)[:2] if not from_file: self.current.missing.add(path) return @@ -366,7 +366,7 @@ class HgChangeReceiver(delta.Editor): def add_directory(self, path, parent_baton, copyfrom_path, copyfrom_revision, dir_pool=None): self.current.batons[path] = path - br_path, branch = self.meta.path_and_branch_for_path(path) + br_path, branch = self.meta.split_branch_path(path)[:2] if br_path is not None: if not copyfrom_path and not br_path: self.current.emptybranches[branch] = True @@ -386,7 +386,7 @@ class HgChangeReceiver(delta.Editor): cp_f = '' else: source_rev = copyfrom_revision - cp_f, source_branch = self.meta.path_and_branch_for_path(copyfrom_path) + cp_f, source_branch = self.meta.split_branch_path(copyfrom_path)[:2] if cp_f == '' and br_path == '': assert br_path is not None tmp = source_branch, source_rev, self.current.rev.revnum @@ -440,7 +440,7 @@ class HgChangeReceiver(delta.Editor): @ieditor def open_directory(self, path, parent_baton, base_revision, dir_pool=None): self.current.batons[path] = path - p_, branch = self.meta.path_and_branch_for_path(path) + p_, branch = self.meta.split_branch_path(path)[:2] if p_ == '': self.current.emptybranches[branch] = False return path
--- a/hgsubversion/svnmeta.py +++ b/hgsubversion/svnmeta.py @@ -226,12 +226,9 @@ class SVNMeta(object): return None, None, None return path, ln, test - def path_and_branch_for_path(self, path, existing=True): - return self.split_branch_path(path, existing=existing)[:2] - def _determine_parent_branch(self, p, src_path, src_rev, revnum): if src_path is not None: - src_file, src_branch = self.path_and_branch_for_path(src_path) + src_file, src_branch = self.split_branch_path(src_path)[:2] src_tag = self.is_path_tag(src_path) if src_tag != False or src_file == '': # case 2 ln = self.localname(p) @@ -300,7 +297,7 @@ class SVNMeta(object): # if you commit to a tag, I'm calling you stupid and ignoring # you. if src_p is not None and src_rev is not None: - file, branch = self.path_and_branch_for_path(src_p) + file, branch = self.split_branch_path(src_p)[:2] if file is None: # some crazy people make tags from other tags file = '' @@ -340,7 +337,7 @@ class SVNMeta(object): # already-known branches, so we mark them as deleted. # 6. It's a branch being replaced by another branch - the # action will be 'R'. - fi, br = self.path_and_branch_for_path(p) + fi, br = self.split_branch_path(p)[:2] if fi is not None: if fi == '': if paths[p].action == 'D': @@ -358,7 +355,7 @@ class SVNMeta(object): parent = self._determine_parent_branch( p, paths[p].copyfrom_path, paths[p].copyfrom_rev, revision.revnum) if not parent and paths[p].copyfrom_path: - bpath, branch = self.path_and_branch_for_path(p, False) + bpath, branch = self.split_branch_path(p, False)[:2] if (bpath is not None and branch not in self.branches and branch not in added_branches):