Use ctx.tmpdir consistently in cvs2git-example.options.
[cvs2svn.git] / cvs2svn_lib / bzr_output_option.py
blob93df85d2313841165c68621876aa97e9308d8709
1 # (Be in -*- python -*- mode.)
3 # ====================================================================
4 # Copyright (c) 2009 CollabNet. All rights reserved.
6 # This software is licensed as described in the file COPYING, which
7 # you should have received as part of this distribution. The terms
8 # are also available at http://subversion.tigris.org/license-1.html.
9 # If newer versions of this license are posted there, you may use a
10 # newer version instead, at your option.
12 # This software consists of voluntary contributions made by many
13 # individuals. For exact contribution history, see the revision
14 # history and logs, available at http://cvs2svn.tigris.org/.
15 # ====================================================================
17 """Classes for outputting the converted repository to bzr.
19 Relies heavily on the support for outputting to git, with a few tweaks to make
20 the dialect of the fast-import file more suited to bzr.
22 """
24 from cvs2svn_lib.git_output_option import GitOutputOption
25 from cvs2svn_lib.symbol import Trunk
28 class BzrOutputOption(GitOutputOption):
29 """An OutputOption that outputs to a git-fast-import formatted file, in a
30 dialect more suited to bzr.
31 """
33 name = "Bzr"
35 def __init__(
36 self, revision_writer,
37 dump_filename=None,
38 author_transforms=None,
39 tie_tag_fixup_branches=True,
41 """Constructor.
43 See superclass for meaning of parameters.
44 """
45 GitOutputOption.__init__(
46 self, revision_writer,
47 dump_filename=dump_filename,
48 author_transforms=author_transforms,
49 tie_tag_fixup_branches=tie_tag_fixup_branches,
52 def get_tag_fixup_branch_name(self, svn_commit):
53 # Use a name containing '.', which is not allowed in CVS symbols, to avoid
54 # conflicts (though of course a conflict could still result if the user
55 # requests symbol transformations).
56 return 'refs/heads/tag-fixup.%s' % svn_commit.symbol.name
58 def describe_lod_to_user(self, lod):
59 """This needs to make sense to users of the fastimported result."""
60 # This sort of needs to replicate the entire branch name mapping logic from
61 # bzr-fastimport :-/
62 if isinstance(lod, Trunk):
63 return 'trunk'
64 else:
65 return lod.name