Mercurial > hgsubversion
changeset 519:247110c633f7
maps: TagMap tags are non-empty strings
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Mon, 18 Jan 2010 21:40:29 +0100 |
parents | e37738d95b27 |
children | 5a5b90a6d522 |
files | hgsubversion/maps.py hgsubversion/svnmeta.py |
diffstat | 2 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/maps.py +++ b/hgsubversion/maps.py @@ -98,7 +98,10 @@ class AuthorMap(dict): class TagMap(dict): + """Map tags to converted node identifier. + tag names are non-empty strings. + """ VERSION = 2 @classmethod @@ -133,6 +136,8 @@ class TagMap(dict): tag = tag[:-1] if self.endrev is not None and revision > self.endrev: break + if not tag: + continue dict.__setitem__(self, tag, node.bin(hash)) f.close() @@ -148,14 +153,17 @@ class TagMap(dict): self[k] = v def __contains__(self, tag): - return dict.__contains__(self, tag) and dict.__getitem__(self, tag) != node.nullid + return (tag and dict.__contains__(self, tag) + and dict.__getitem__(self, tag) != node.nullid) def __getitem__(self, tag): - if tag in self: + if tag and tag in self: return dict.__getitem__(self, tag) raise KeyError() def __setitem__(self, tag, info): + if not tag: + raise hgutil.Abort('tag cannot be empty') hash, revision = info f = open(self.path, 'a') f.write('%s %s %s\n' % (node.hex(hash), revision, tag))
--- a/hgsubversion/svnmeta.py +++ b/hgsubversion/svnmeta.py @@ -300,7 +300,7 @@ class SVNMeta(object): src_tag = self.get_path_tag(src_path) if src_tag or src_file == '': ln = self.localname(p) - if src_tag and src_tag in self.tags: + if src_tag in self.tags: ci = self.repo[self.tags[src_tag]].extra()['convert_revision'] src_rev, src_branch, = self.parse_converted_revision(ci) return {ln: (src_branch, src_rev, revnum)} @@ -350,7 +350,7 @@ class SVNMeta(object): ''' tag = self.get_path_tag(self.remotename(branch)) limitedtags = maps.TagMap(self.repo, endrev=number-1) - if tag and tag in limitedtags: + if tag in limitedtags: ha = limitedtags[tag] return ha r, br = self.get_parent_svn_branch_and_rev(number, branch)