# HG changeset patch # User Dirkjan Ochtman # Date 1243497480 -7200 # Node ID e8f5688a0cd98907de726a12de63d34c8d26d743 # Parent b71c8f9357402a3e74b13ef269a6503eb1b14996 Merge hge._is_path_tag() and hge._split_tag_path(). diff --git a/hgsubversion/hg_delta_editor.py b/hgsubversion/hg_delta_editor.py --- a/hgsubversion/hg_delta_editor.py +++ b/hgsubversion/hg_delta_editor.py @@ -412,35 +412,23 @@ class HgChangeReceiver(delta.Editor): return False return self._is_file_included(subpath) - def _is_path_tag(self, path): - """If path could represent the path to a tag, returns the potential tag name. - - Note that it's only a tag if it was copied from the path '' in a branch (or tag) - we have, for our purposes. - - Otherwise, returns False. - """ - return self._split_tag_path(path)[1] or False - - def _split_tag_path(self, path): - """Figure out which tag inside our repo this path represents, and - also figure out which path inside that tag it is. + """If path could represent the path to a tag, returns the potential tag + name. Otherwise, returns False. - Returns a tuple of (path within tag, tag name, server-side tag - path). + Note that it's only a tag if it was copied from the path '' in a branch + (or tag) we have, for our purposes. """ path = self._normalize_path(path) - for tags_path in self.tag_locations: - if path and (path.startswith(tags_path) and - len(path) > len('%s/' % tags_path)): - tag = path[len(tags_path)+1:] + for tagspath in self.tag_locations: + onpath = path.startswith(tagspath) + longer = len(path) > len('%s/' % tagspath) + if path and onpath and longer: + tag, subpath = path[len(tagspath) + 1:], '' if '/' in tag: tag, subpath = tag.split('/', 1) - else: - subpath = '' - return (subpath, tag, '%s/%s' % (tags_path, tag)) - return (None, None, None) + return tag + return False def get_parent_svn_branch_and_rev(self, number, branch): number -= 1