summaryrefslogtreecommitdiff
path: root/contrib/remote-helpers/git-remote-bzr
diff options
context:
space:
mode:
authorLibravatar Felipe Contreras <felipe.contreras@gmail.com>2013-04-08 13:36:39 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-04-08 14:17:07 -0700
commitfa7285dc3dce8bd01fd8c665b032603ed55348e5 (patch)
treec286015b3e1964c823ff770413babf3e8c88313b /contrib/remote-helpers/git-remote-bzr
parentremote-bzr: fix utf-8 support for fetching (diff)
downloadtgif-fa7285dc3dce8bd01fd8c665b032603ed55348e5.tar.xz
remote-bzr: improve tag handling
revision_history() is deprecated and doesn't do what we want (revno instead of dotted_revno?). Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/remote-helpers/git-remote-bzr')
-rwxr-xr-xcontrib/remote-helpers/git-remote-bzr25
1 files changed, 16 insertions, 9 deletions
diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr
index 55ebf195be..bd25e08202 100755
--- a/contrib/remote-helpers/git-remote-bzr
+++ b/contrib/remote-helpers/git-remote-bzr
@@ -25,6 +25,7 @@ bzrlib.plugin.load_plugins()
import bzrlib.generate_ids
import bzrlib.transport
+import bzrlib.errors
import sys
import os
@@ -335,12 +336,9 @@ def export_branch(branch, name):
def export_tag(repo, name):
global tags
- try:
- print "reset refs/tags/%s" % name
- print "from :%u" % rev_to_mark(tags[name])
- print
- except KeyError:
- warn("TODO: fetch tag '%s'" % name)
+ print "reset refs/tags/%s" % name
+ print "from :%u" % rev_to_mark(tags[name])
+ print
def do_import(parser):
global dirname
@@ -660,16 +658,25 @@ def do_capabilities(parser):
print
+def ref_is_valid(name):
+ return not True in [c in name for c in '~^: \\']
+
def do_list(parser):
global tags
print "? refs/heads/%s" % 'master'
- history = parser.repo.revision_history()
- for tag, revid in parser.repo.tags.get_tag_dict().items():
- if revid not in history:
+ branch = parser.repo
+ branch.lock_read()
+ for tag, revid in branch.tags.get_tag_dict().items():
+ try:
+ branch.revision_id_to_dotted_revno(revid)
+ except bzrlib.errors.NoSuchRevision:
+ continue
+ if not ref_is_valid(tag):
continue
print "? refs/tags/%s" % tag
tags[tag] = revid
+ branch.unlock()
print "@refs/heads/%s HEAD" % 'master'
print