diff tag_repo.py @ 124:291925677a9f

tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
author Luke Opperman <luke@loppear.com>
date Thu, 04 Dec 2008 13:10:40 -0600
parents
children 91c818377703
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/tag_repo.py
@@ -0,0 +1,25 @@
+import pickle
+
+from mercurial import node
+
+import hg_delta_editor
+
+
+def tags_from_tag_info(repo):
+    hg_editor = hg_delta_editor.HgChangeReceiver(repo=repo)
+    for tag, source in hg_editor.tags.iteritems():
+        source_ha = hg_editor.get_parent_revision(source[1]+1, source[0])
+        yield 'tag/%s'%tag, node.hex(source_ha)
+
+
+def generate_repo_class(ui, repo):
+
+    class svntagrepo(repo.__class__):
+        def tags(self):
+            tags = dict((k, node.bin(v))
+                        for k,v in tags_from_tag_info(self))
+            hg_tags = super(svntagrepo, self).tags()
+            tags.update(hg_tags)
+            return tags
+
+    return svntagrepo