summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2013-05-04 00:31:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-05-07 01:19:55 (GMT)
commit4c00819910706aa8ae450292085e47e52c333440 (patch)
tree618aa6396d85d96549bb4740a49e0d392bbd9762 /contrib
parent081811216e99fe0396d74d8a2bd6dd3d119dccde (diff)
downloadgit-4c00819910706aa8ae450292085e47e52c333440.zip
git-4c00819910706aa8ae450292085e47e52c333440.tar.gz
git-4c00819910706aa8ae450292085e47e52c333440.tar.bz2
remote-bzr: avoid bad refs
Versions of fast-export before v1.8.2 throws a bad 'reset' commands because of a behavior in transport-helper that is not even needed. We should ignore them, otherwise we will treat them as branches and fail. This was fixed in v1.8.2, but some people use this script in older versions of git. Also, check if the ref was a tag, and skip it for now. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/remote-helpers/git-remote-bzr38
1 files changed, 23 insertions, 15 deletions
diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr
index bbaaa8f..0ef30f8 100755
--- a/contrib/remote-helpers/git-remote-bzr
+++ b/contrib/remote-helpers/git-remote-bzr
@@ -682,23 +682,31 @@ def do_export(parser):
die('unhandled export command: %s' % line)
for ref, revid in parsed_refs.iteritems():
- name = ref[len('refs/heads/'):]
- branch = bzrlib.branch.Branch.open(branches[name])
- branch.generate_revision_history(revid, marks.get_tip(name))
+ if ref.startswith('refs/heads/'):
+ name = ref[len('refs/heads/'):]
+ branch = bzrlib.branch.Branch.open(branches[name])
+ branch.generate_revision_history(revid, marks.get_tip(name))
- if name in peers:
- peer = bzrlib.branch.Branch.open(peers[name])
- try:
- peer.bzrdir.push_branch(branch, revision_id=revid)
- except bzrlib.errors.DivergedBranches:
- print "error %s non-fast forward" % ref
- continue
+ if name in peers:
+ peer = bzrlib.branch.Branch.open(peers[name])
+ try:
+ peer.bzrdir.push_branch(branch, revision_id=revid)
+ except bzrlib.errors.DivergedBranches:
+ print "error %s non-fast forward" % ref
+ continue
- try:
- wt = branch.bzrdir.open_workingtree()
- wt.update()
- except bzrlib.errors.NoWorkingTree:
- pass
+ try:
+ wt = branch.bzrdir.open_workingtree()
+ wt.update()
+ except bzrlib.errors.NoWorkingTree:
+ pass
+ elif ref.startswith('refs/tags/'):
+ # TODO: implement tag push
+ print "error %s pushing tags not supported" % ref
+ continue
+ else:
+ # transport-helper/fast-export bugs
+ continue
print "ok %s" % ref