/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to cmds.py

Merge removal of exporters.

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
      bzr fast-import project.fi project.bzr
73
73
 
74
74
    Numerous commands are provided for generating a fast-import file
75
 
    to use as input. These are named fast-export-from-xxx where xxx
76
 
    is one of cvs, darcs, git, hg, mtn, p4 or svn.
 
75
    to use as input. 
77
76
    To specify standard input as the input stream, use a
78
77
    source name of '-' (instead of project.fi). If the source name
79
78
    ends in '.gz', it is assumed to be compressed in gzip format.
80
 
    
 
79
 
81
80
    project.bzr will be created if it doesn't exist. If it exists
82
81
    already, it should be empty or be an existing Bazaar repository
83
82
    or branch. If not specified, the current directory is assumed.
84
 
 
 
83
 
85
84
    fast-import will intelligently select the format to use when
86
85
    creating a repository or branch. If you are running Bazaar 1.17
87
86
    up to Bazaar 2.0, the default format for Bazaar 2.x ("2a") is used.
200
199
 
201
200
     Import a Subversion repository into Bazaar::
202
201
 
203
 
       bzr fast-export-from-svn /svn/repo/path project.fi
 
202
       svn-fast-export /svn/repo/path > project.fi
204
203
       bzr fast-import project.fi project.bzr
205
204
 
206
205
     Import a CVS repository into Bazaar::
207
206
 
208
 
       bzr fast-export-from-cvs /cvs/repo/path project.fi
 
207
       cvs2git /cvs/repo/path > project.fi
209
208
       bzr fast-import project.fi project.bzr
210
209
 
211
210
     Import a Git repository into Bazaar::
212
211
 
213
 
       bzr fast-export-from-git /git/repo/path project.fi
 
212
       cd /git/repo/path
 
213
       git fast-export --all > project.fi
214
214
       bzr fast-import project.fi project.bzr
215
215
 
216
216
     Import a Mercurial repository into Bazaar::
217
217
 
218
 
       bzr fast-export-from-hg /hg/repo/path project.fi
 
218
       cd /hg/repo/path
 
219
       hg fast-export > project.fi
219
220
       bzr fast-import project.fi project.bzr
220
221
 
221
222
     Import a Darcs repository into Bazaar::
222
223
 
223
 
       bzr fast-export-from-darcs /darcs/repo/path project.fi
 
224
       cd /darcs/repo/path
 
225
       darcs-fast-export > project.fi
224
226
       bzr fast-import project.fi project.bzr
225
227
    """
226
228
    hidden = False
690
692
            revision=revision, verbose=verbose, plain_format=plain,
691
693
            rewrite_tags=rewrite_tag_names, baseline=baseline)
692
694
        return exporter.run()
693
 
 
694
 
 
695
 
class cmd_fast_export_from_cvs(Command):
696
 
    """Generate a fast-import file from a CVS repository.
697
 
 
698
 
    Destination is a dump file, typically named xxx.fi where xxx is
699
 
    the name of the project. If '-' is given, standard output is used.
700
 
 
701
 
    cvs2svn 2.3 or later must be installed as its cvs2bzr script is used
702
 
    under the covers to do the export.
703
 
    
704
 
    The source must be the path on your filesystem to the part of the
705
 
    repository you wish to convert. i.e. either that path or a parent
706
 
    directory must contain a CVSROOT subdirectory. The path may point to
707
 
    either the top of a repository or to a path within it. In the latter
708
 
    case, only that project within the repository will be converted.
709
 
 
710
 
    .. note::
711
 
       Remote access to the repository is not sufficient - the path
712
 
       must point into a copy of the repository itself. See
713
 
       http://cvs2svn.tigris.org/faq.html#repoaccess for instructions
714
 
       on how to clone a remote CVS repository locally.
715
 
 
716
 
    By default, the trunk, branches and tags are all exported. If you
717
 
    only want the trunk, use the `--trunk-only` option.
718
 
 
719
 
    By default, filenames, log messages and author names are expected
720
 
    to be encoded in ascii. Use the `--encoding` option to specify an
721
 
    alternative. If multiple encodings are used, specify the option
722
 
    multiple times. For a list of valid encoding names, see
723
 
    http://docs.python.org/lib/standard-encodings.html.
724
 
 
725
 
    Windows users need to install GNU sort and use the `--sort`
726
 
    option to specify its location. GNU sort can be downloaded from
727
 
    http://unxutils.sourceforge.net/.
728
 
    """
729
 
    hidden = False
730
 
    _see_also = ['fast-import', 'fast-import-filter']
731
 
    takes_args = ['source', 'destination']
732
 
    takes_options = ['verbose',
733
 
                    Option('trunk-only',
734
 
                        help="Export just the trunk, ignoring tags and branches."
735
 
                        ),
736
 
                    ListOption('encoding', type=str, argname='CODEC',
737
 
                        help="Encoding used for filenames, commit messages "
738
 
                             "and author names if not ascii."
739
 
                        ),
740
 
                    Option('sort', type=str, argname='PATH',
741
 
                        help="GNU sort program location if not on the path."
742
 
                        ),
743
 
                    ]
744
 
    encoding_type = 'exact'
745
 
    def run(self, source, destination, verbose=False, trunk_only=False,
746
 
        encoding=None, sort=None):
747
 
        load_fastimport()
748
 
        from bzrlib.plugins.fastimport.exporters import fast_export_from
749
 
        custom = []
750
 
        if trunk_only:
751
 
            custom.append("--trunk-only")
752
 
        if encoding:
753
 
            for enc in encoding:
754
 
                custom.extend(['--encoding', enc])
755
 
        if sort:
756
 
            custom.extend(['--sort', sort])
757
 
        fast_export_from(source, destination, 'cvs', verbose, custom)
758
 
 
759
 
 
760
 
class cmd_fast_export_from_darcs(Command):
761
 
    """Generate a fast-import file from a Darcs repository.
762
 
 
763
 
    Destination is a dump file, typically named xxx.fi where xxx is
764
 
    the name of the project. If '-' is given, standard output is used.
765
 
 
766
 
    Darcs 2.2 or later must be installed as various subcommands are
767
 
    used to access the source repository. The source may be a network
768
 
    URL but using a local URL is recommended for performance reasons.
769
 
    """
770
 
    hidden = False
771
 
    _see_also = ['fast-import', 'fast-import-filter']
772
 
    takes_args = ['source', 'destination']
773
 
    takes_options = ['verbose',
774
 
                    Option('encoding', type=str, argname='CODEC',
775
 
                        help="Encoding used for commit messages if not utf-8."
776
 
                        ),
777
 
                    ]
778
 
    encoding_type = 'exact'
779
 
    def run(self, source, destination, verbose=False, encoding=None):
780
 
        from bzrlib.plugins.fastimport.exporters import fast_export_from
781
 
        custom = None
782
 
        if encoding is not None:
783
 
            custom = ['--encoding', encoding]
784
 
        fast_export_from(source, destination, 'darcs', verbose, custom)
785
 
 
786
 
 
787
 
class cmd_fast_export_from_hg(Command):
788
 
    """Generate a fast-import file from a Mercurial repository.
789
 
 
790
 
    Destination is a dump file, typically named xxx.fi where xxx is
791
 
    the name of the project. If '-' is given, standard output is used.
792
 
 
793
 
    Mercurial 1.2 or later must be installed as its libraries are used
794
 
    to access the source repository. Given the APIs currently used,
795
 
    the source repository must be a local file, not a network URL.
796
 
    """
797
 
    hidden = False
798
 
    _see_also = ['fast-import', 'fast-import-filter']
799
 
    takes_args = ['source', 'destination']
800
 
    takes_options = ['verbose']
801
 
    encoding_type = 'exact'
802
 
    def run(self, source, destination, verbose=False):
803
 
        load_fastimport()
804
 
        from bzrlib.plugins.fastimport.exporters import fast_export_from
805
 
        fast_export_from(source, destination, 'hg', verbose)
806
 
 
807
 
 
808
 
class cmd_fast_export_from_git(Command):
809
 
    """Generate a fast-import file from a Git repository.
810
 
 
811
 
    Destination is a dump file, typically named xxx.fi where xxx is
812
 
    the name of the project. If '-' is given, standard output is used.
813
 
 
814
 
    Git 1.6 or later must be installed as the git fast-export
815
 
    subcommand is used under the covers to generate the stream.
816
 
    The source must be a local directory.
817
 
 
818
 
    .. note::
819
 
    
820
 
       Earlier versions of Git may also work fine but are
821
 
       likely to receive less active support if problems arise.
822
 
    """
823
 
    hidden = False
824
 
    _see_also = ['fast-import', 'fast-import-filter']
825
 
    takes_args = ['source', 'destination']
826
 
    takes_options = ['verbose']
827
 
    encoding_type = 'exact'
828
 
    def run(self, source, destination, verbose=False):
829
 
        load_fastimport()
830
 
        from bzrlib.plugins.fastimport.exporters import fast_export_from
831
 
        fast_export_from(source, destination, 'git', verbose)
832
 
 
833
 
 
834
 
class cmd_fast_export_from_mtn(Command):
835
 
    """Generate a fast-import file from a Monotone repository.
836
 
 
837
 
    Destination is a dump file, typically named xxx.fi where xxx is
838
 
    the name of the project. If '-' is given, standard output is used.
839
 
 
840
 
    Monotone 0.43 or later must be installed as the mtn git_export
841
 
    subcommand is used under the covers to generate the stream.
842
 
    The source must be a local directory.
843
 
    """
844
 
    hidden = False
845
 
    _see_also = ['fast-import', 'fast-import-filter']
846
 
    takes_args = ['source', 'destination']
847
 
    takes_options = ['verbose']
848
 
    encoding_type = 'exact'
849
 
    def run(self, source, destination, verbose=False):
850
 
        load_fastimport()
851
 
        from bzrlib.plugins.fastimport.exporters import fast_export_from
852
 
        fast_export_from(source, destination, 'mtn', verbose)
853
 
 
854
 
 
855
 
class cmd_fast_export_from_p4(Command):
856
 
    """Generate a fast-import file from a Perforce repository.
857
 
 
858
 
    Source is a Perforce depot path, e.g., //depot/project
859
 
 
860
 
    Destination is a dump file, typically named xxx.fi where xxx is
861
 
    the name of the project. If '-' is given, standard output is used.
862
 
 
863
 
    bzrp4 must be installed as its p4_fast_export.py module is used under
864
 
    the covers to do the export.  bzrp4 can be downloaded from
865
 
    https://launchpad.net/bzrp4/.
866
 
 
867
 
    The P4PORT environment variable must be set, and you must be logged
868
 
    into the Perforce server.
869
 
 
870
 
    By default, only the HEAD changelist is exported.  To export all
871
 
    changelists, append '@all' to the source.  To export a revision range,
872
 
    append a comma-delimited pair of changelist numbers to the source,
873
 
    e.g., '100,200'.
874
 
    """
875
 
    hidden = False
876
 
    _see_also = ['fast-import', 'fast-import-filter']
877
 
    takes_args = ['source', 'destination']
878
 
    takes_options = []
879
 
    encoding_type = 'exact'
880
 
    def run(self, source, destination, verbose=False):
881
 
        load_fastimport()
882
 
        from bzrlib.plugins.fastimport.exporters import fast_export_from
883
 
        custom = []
884
 
        fast_export_from(source, destination, 'p4', verbose, custom)
885
 
 
886
 
 
887
 
class cmd_fast_export_from_svn(Command):
888
 
    """Generate a fast-import file from a Subversion repository.
889
 
 
890
 
    Destination is a dump file, typically named xxx.fi where xxx is
891
 
    the name of the project. If '-' is given, standard output is used.
892
 
 
893
 
    Python-Subversion (Python bindings to the Subversion APIs)
894
 
    1.4 or later must be installed as this library is used to
895
 
    access the source repository. The source may be a network URL
896
 
    but using a local URL is recommended for performance reasons.
897
 
    """
898
 
    hidden = False
899
 
    _see_also = ['fast-import', 'fast-import-filter']
900
 
    takes_args = ['source', 'destination']
901
 
    takes_options = ['verbose',
902
 
                    Option('trunk-path', type=str, argname="STR",
903
 
                        help="Path in repo to /trunk.\n"
904
 
                              "May be `regex:/cvs/(trunk)/proj1/(.*)` in "
905
 
                              "which case the first group is used as the "
906
 
                              "branch name and the second group is used "
907
 
                              "to match files.",
908
 
                        ),
909
 
                    ]
910
 
    encoding_type = 'exact'
911
 
    def run(self, source, destination, verbose=False, trunk_path=None):
912
 
        load_fastimport()
913
 
        from bzrlib.plugins.fastimport.exporters import fast_export_from
914
 
        custom = []
915
 
        if trunk_path is not None:
916
 
            custom.extend(['--trunk-path', trunk_path])
917
 
        fast_export_from(source, destination, 'svn', verbose, custom)