bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
1 |
# Copyright (C) 2008 Canonical Ltd
|
2 |
#
|
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
|
0.64.81
by Ian Clatworthy
'bzr help fastimport' now provides useful help |
17 |
r"""FastImport Plugin |
18 |
=================
|
|
19 |
||
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
20 |
The fastimport plugin provides stream-based importing and exporting of
|
21 |
data into and out of Bazaar. As well as enabling interchange between
|
|
|
0.64.81
by Ian Clatworthy
'bzr help fastimport' now provides useful help |
22 |
multiple VCS tools, fastimport/export can be useful for complex branch
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
23 |
operations, e.g. partitioning off part of a code base in order to Open
|
|
0.64.81
by Ian Clatworthy
'bzr help fastimport' now provides useful help |
24 |
Source it.
|
25 |
||
26 |
The normal import recipe is::
|
|
27 |
||
28 |
bzr init-repo .
|
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
29 |
bzr fast-export-from-xxx SOURCE project.fi
|
30 |
bzr fast-import project.fi
|
|
31 |
||
32 |
If fast-export-from-xxx doesn't exist yet for the tool you're importing
|
|
33 |
from, the alternative recipe is::
|
|
34 |
||
35 |
bzr init-repo .
|
|
36 |
front-end > project.fi
|
|
37 |
bzr fast-import project.fi
|
|
38 |
||
39 |
The list of known front-ends and their status is documented on
|
|
40 |
http://bazaar-vcs.org/BzrFastImport/FrontEnds. The fast-export-from-xxx
|
|
41 |
commands provide simplified access to these so that the majority of users
|
|
42 |
can generate a fast-import dump file without needing to study up on all
|
|
43 |
the options - and the best combination of them to use - for the front-end
|
|
44 |
relevant to them. In some cases, a fast-export-from-xxx wrapper will require
|
|
45 |
that certain dependencies are installed so it checks for these before
|
|
46 |
starting. A wrapper may also provide a limited set of options. See the
|
|
47 |
online help for the individual commands for details::
|
|
48 |
||
|
0.64.205
by Ian Clatworthy
added fast-export-to-cvs |
49 |
bzr help fast-export-from-cvs
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
50 |
bzr help fast-export-from-darcs
|
51 |
bzr help fast-export-from-hg
|
|
52 |
bzr help fast-export-from-git
|
|
|
0.64.205
by Ian Clatworthy
added fast-export-to-cvs |
53 |
bzr help fast-export-from-mnt
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
54 |
bzr help fast-export-from-svn
|
55 |
||
56 |
Once a fast-import dump file is created, it can be imported into a
|
|
57 |
Bazaar repository using the fast-import command. If required, you can
|
|
58 |
manipulate the stream first using the fast-import-filter command.
|
|
59 |
This is useful for creating a repository with just part of a project
|
|
60 |
or for removing large old binaries (say) from history that are no longer
|
|
61 |
valuable to retain. For further details on importing, manipulating and
|
|
62 |
reporting on fast-import streams, see the online help for the commands::
|
|
|
0.64.81
by Ian Clatworthy
'bzr help fastimport' now provides useful help |
63 |
|
64 |
bzr help fast-import
|
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
65 |
bzr help fast-import-filter
|
|
0.64.81
by Ian Clatworthy
'bzr help fastimport' now provides useful help |
66 |
bzr help fast-import-info
|
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
67 |
bzr help fast-import-query
|
|
0.64.81
by Ian Clatworthy
'bzr help fastimport' now provides useful help |
68 |
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
69 |
Finally, you may wish to generate a fast-import dump file from a Bazaar
|
70 |
repository. The fast-export command is provided for that purpose.
|
|
71 |
||
|
0.64.81
by Ian Clatworthy
'bzr help fastimport' now provides useful help |
72 |
To report bugs or publish enhancements, visit the bzr-fastimport project
|
73 |
page on Launchpad, https://launchpad.net/bzr-fastimport.
|
|
74 |
"""
|
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
75 |
|
|
0.64.185
by Ian Clatworthy
Open 0.9 development |
76 |
version_info = (0, 9, 0, 'dev', 0) |
|
0.64.126
by Ian Clatworthy
ensure version appears in bzr plugins output (Alexander Belchenko) |
77 |
|
|
0.95.1
by Ian Clatworthy
Create a repository implicitly if one doesn't already exist |
78 |
from bzrlib import bzrdir |
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
79 |
from bzrlib.commands import Command, register_command |
|
0.64.171
by Ian Clatworthy
use inv deltas by default for all formats now: --classic to get old algorithm for packs |
80 |
from bzrlib.option import Option, ListOption, RegistryOption |
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
81 |
|
82 |
||
83 |
def test_suite(): |
|
84 |
import tests |
|
85 |
return tests.test_suite() |
|
86 |
||
87 |
||
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
88 |
def _run(source, processor_factory, control, params, verbose): |
89 |
"""Create and run a processor. |
|
90 |
|
|
91 |
:param source: a filename or '-' for standard input
|
|
92 |
:param processor_factory: a callable for creating a processor
|
|
93 |
:param control: the BzrDir of the destination or None if no
|
|
94 |
destination is expected
|
|
95 |
"""
|
|
96 |
import parser |
|
97 |
if source == '-': |
|
98 |
import sys |
|
|
0.84.2
by Ian Clatworthy
make sure fast-export uses a binary stream on Windows |
99 |
stream = helpers.binary_stream(sys.stdin) |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
100 |
else: |
|
0.65.6
by James Westby
Open the input in binary mode, as suggested by Paul Moore. |
101 |
stream = open(source, "rb") |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
102 |
proc = processor_factory(control, params=params, verbose=verbose) |
103 |
p = parser.ImportParser(stream, verbose=verbose) |
|
104 |
return proc.process(p.iter_commands) |
|
|
0.64.8
by Ian Clatworthy
custom parameters for processors |
105 |
|
106 |
||
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
107 |
class cmd_fast_import(Command): |
108 |
"""Backend for fast Bazaar data importers. |
|
109 |
||
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
110 |
This command reads a mixed command/data stream and
|
111 |
creates branches in the current repository accordingly.
|
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
112 |
The usual recipe is::
|
113 |
||
114 |
bzr fast-import project.fi
|
|
115 |
||
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
116 |
To specify standard input as the input stream, use a
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
117 |
source name of '-' (instead of project.fi). Numerous commands
|
118 |
are provided for generating a fast-import stream to use as input.
|
|
119 |
These include fast-export-from-svn, fast-export-from-git,
|
|
120 |
fast-export-from-hg and fast-export-from-darcs.
|
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
121 |
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
122 |
If you wish to write a custom exporter for your project, see
|
123 |
http://bazaar-vcs.org/BzrFastImport for the detailed protocol
|
|
124 |
specification. In many cases, exporters can be written quite
|
|
125 |
quickly using whatever scripting/programming language you like.
|
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
126 |
|
127 |
If run inside a branch using a shared repository, then
|
|
128 |
the current branch is made the trunk and other branches,
|
|
129 |
if any, are created in sister directories. If run inside
|
|
130 |
a standalone tree, the current branch is also made the
|
|
131 |
trunk, but warnings are output about other branches found.
|
|
|
0.82.1
by Ian Clatworthy
nicer and round-trippable mapping of git ref names to bzr branch names |
132 |
|
133 |
Git reference names are mapped to bzr branch names as follows:
|
|
134 |
|
|
135 |
* refs/heads/foo is mapped to foo
|
|
136 |
* refs/remotes/origin/foo is mapped to foo.remote
|
|
137 |
* refs/tags/foo is mapped to foo.tag
|
|
138 |
* */master is mapped to trunk, trunk.remote, etc.
|
|
139 |
* */trunk is mapped to git-trunk, git-trunk.remote, etc.
|
|
140 |
||
141 |
||
|
0.64.50
by Ian Clatworthy
cleanly restart after an interruption - basic mirroring |
142 |
At checkpoints and on completion, the commit-id -> revision-id
|
143 |
map is saved to a file called 'fastimport-id-map' in the control
|
|
144 |
directory for the repository (e.g. .bzr/repository). If the import
|
|
145 |
is interrupted or unexpectedly crashes, it can be started again
|
|
146 |
and this file will be used to skip over already loaded revisions.
|
|
147 |
As long as subsequent exports from the original source begin
|
|
148 |
with exactly the same revisions, you can use this feature to
|
|
149 |
maintain a mirror of a repository managed by a foreign tool.
|
|
150 |
If and when Bazaar is used to manage the repository, this file
|
|
151 |
can be safely deleted.
|
|
152 |
||
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
153 |
Note: A slightly more complex recipe is required when importing large
|
154 |
projects via exporters that reuse blob data across commits, namely::
|
|
155 |
||
156 |
bzr init-repo .
|
|
157 |
front-end > xxx.fi
|
|
158 |
bzr fast-import-info -v xxx.fi > xxx.cfg
|
|
159 |
bzr fast-import xxx.fi --info xxx.cfg
|
|
160 |
||
161 |
In this scenario, the xxx.cfg file generated by the first pass
|
|
162 |
holds caching hints that the second pass uses to lower memory
|
|
163 |
usage. Development is planned so that this recipe becomes obsolete
|
|
164 |
in the future, i.e. so that the simple recipe always works.
|
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
165 |
|
|
0.64.201
by Ian Clatworthy
tweak help formatting |
166 |
:Examples:
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
167 |
|
|
0.64.201
by Ian Clatworthy
tweak help formatting |
168 |
Import a Subversion repository into Bazaar::
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
169 |
|
170 |
bzr fast-export-from-svn /svn/repo/path project.fi
|
|
171 |
bzr fast-import project.fi
|
|
172 |
||
|
0.64.201
by Ian Clatworthy
tweak help formatting |
173 |
Import a Git repository into Bazaar::
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
174 |
|
175 |
bzr fast-export-from-git /git/repo/path project.fi
|
|
176 |
bzr fast-import project.fi
|
|
177 |
||
|
0.64.201
by Ian Clatworthy
tweak help formatting |
178 |
Import a Mercurial repository into Bazaar::
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
179 |
|
180 |
bzr fast-export-from-hg /hg/repo/path project.fi
|
|
181 |
bzr fast-import project.fi
|
|
182 |
||
|
0.64.201
by Ian Clatworthy
tweak help formatting |
183 |
Import a Darcs repository into Bazaar::
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
184 |
|
185 |
bzr fast-export-from-darcs /darcs/repo/path project.fi
|
|
186 |
bzr fast-import project.fi
|
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
187 |
"""
|
|
0.64.120
by Ian Clatworthy
unhide fast-import and fast-import-info commands |
188 |
hidden = False |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
189 |
_see_also = ['fast-export', 'fast-import-filter', 'fast-import-info'] |
|
0.95.1
by Ian Clatworthy
Create a repository implicitly if one doesn't already exist |
190 |
takes_args = ['source', 'destination?'] |
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
191 |
takes_options = ['verbose', |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
192 |
Option('info', type=str, |
193 |
help="Path to file containing caching hints.", |
|
194 |
),
|
|
195 |
Option('trees', |
|
196 |
help="Update working trees.", |
|
197 |
),
|
|
198 |
Option('count', type=int, |
|
199 |
help="Import this many revisions then exit.", |
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
200 |
),
|
|
0.64.170
by Ian Clatworthy
add autopack option to fast-import |
201 |
Option('checkpoint', type=int, |
202 |
help="Checkpoint automatically every N revisions." |
|
203 |
" The default is 10000.", |
|
204 |
),
|
|
205 |
Option('autopack', type=int, |
|
206 |
help="Pack every N checkpoints. The default is 4.", |
|
207 |
),
|
|
|
0.64.44
by Ian Clatworthy
smart caching of serialised inventories |
208 |
Option('inv-cache', type=int, |
209 |
help="Number of inventories to cache.", |
|
210 |
),
|
|
|
0.64.171
by Ian Clatworthy
use inv deltas by default for all formats now: --classic to get old algorithm for packs |
211 |
RegistryOption.from_kwargs('mode', |
212 |
'The import algorithm to use.', |
|
213 |
title='Import Algorithm', |
|
214 |
default='Use the preferred algorithm (inventory deltas).', |
|
215 |
classic="Use the original algorithm (mutable inventories).", |
|
216 |
experimental="Enable experimental features.", |
|
217 |
value_switches=True, enum_switch=False, |
|
|
0.64.47
by Ian Clatworthy
add option for enabling experimental stuff |
218 |
),
|
|
0.68.7
by Pieter de Bie
Add importing and exporting of marks to bzr-fastimport |
219 |
Option('import-marks', type=str, |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
220 |
help="Import marks from file." |
221 |
),
|
|
|
0.68.7
by Pieter de Bie
Add importing and exporting of marks to bzr-fastimport |
222 |
Option('export-marks', type=str, |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
223 |
help="Export marks to file." |
224 |
),
|
|
|
0.95.1
by Ian Clatworthy
Create a repository implicitly if one doesn't already exist |
225 |
RegistryOption('format', |
226 |
help='Specify a format for the created repository. See' |
|
227 |
' "bzr help formats" for details.', |
|
228 |
lazy_registry=('bzrlib.bzrdir', 'format_registry'), |
|
229 |
converter=lambda name: bzrdir.format_registry.make_bzrdir(name), |
|
230 |
value_switches=False, title='Repository format'), |
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
231 |
]
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
232 |
aliases = [] |
|
0.95.1
by Ian Clatworthy
Create a repository implicitly if one doesn't already exist |
233 |
def run(self, source, destination='.', verbose=False, info=None, |
234 |
trees=False, count=-1, checkpoint=10000, autopack=4, inv_cache=-1, |
|
235 |
mode=None, import_marks=None, export_marks=None, format=None): |
|
|
0.64.135
by Ian Clatworthy
improve error message when .bzr directory not found |
236 |
from bzrlib.errors import BzrCommandError, NotBranchError |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
237 |
from bzrlib.plugins.fastimport.processors import generic_processor |
|
0.95.1
by Ian Clatworthy
Create a repository implicitly if one doesn't already exist |
238 |
from bzrlib.plugins.fastimport.helpers import ( |
239 |
open_destination_directory, |
|
240 |
)
|
|
|
0.64.171
by Ian Clatworthy
use inv deltas by default for all formats now: --classic to get old algorithm for packs |
241 |
if mode is None: |
242 |
mode = 'default' |
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
243 |
params = { |
244 |
'info': info, |
|
245 |
'trees': trees, |
|
|
0.64.170
by Ian Clatworthy
add autopack option to fast-import |
246 |
'count': count, |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
247 |
'checkpoint': checkpoint, |
|
0.64.170
by Ian Clatworthy
add autopack option to fast-import |
248 |
'autopack': autopack, |
|
0.64.44
by Ian Clatworthy
smart caching of serialised inventories |
249 |
'inv-cache': inv_cache, |
|
0.64.171
by Ian Clatworthy
use inv deltas by default for all formats now: --classic to get old algorithm for packs |
250 |
'mode': mode, |
|
0.68.7
by Pieter de Bie
Add importing and exporting of marks to bzr-fastimport |
251 |
'import-marks': import_marks, |
252 |
'export-marks': export_marks, |
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
253 |
}
|
|
0.95.1
by Ian Clatworthy
Create a repository implicitly if one doesn't already exist |
254 |
# If no format is given and the user is running a release
|
255 |
# leading up to 2.0, select 2a for them. Otherwise, use
|
|
256 |
# the default format.
|
|
257 |
if format is None: |
|
258 |
import bzrlib |
|
259 |
bzr_version = bzrlib.version_info[0:2] |
|
260 |
if bzr_version in [(1,17), (1,18), (2,0)]: |
|
261 |
format = bzrdir.format_registry.make_bzrdir('2a') |
|
262 |
control = open_destination_directory(destination, format=format) |
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
263 |
return _run(source, generic_processor.GenericProcessor, control, |
264 |
params, verbose) |
|
265 |
||
266 |
||
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
267 |
class cmd_fast_import_filter(Command): |
268 |
"""Filter a fast-import stream to include/exclude files & directories. |
|
269 |
||
270 |
This command is useful for splitting a subdirectory or bunch of
|
|
271 |
files out from a project to create a new project complete with history
|
|
272 |
for just those files. It can also be used to create a new project
|
|
273 |
repository that removes all references to files that should not have
|
|
274 |
been committed, e.g. security-related information (like passwords),
|
|
275 |
commercially sensitive material, files with an incompatible license or
|
|
276 |
large binary files like CD images.
|
|
277 |
||
278 |
When filtering out a subdirectory (or file), the new stream uses the
|
|
279 |
subdirectory (or subdirectory containing the file) as the root. As
|
|
280 |
fast-import doesn't know in advance whether a path is a file or
|
|
281 |
directory in the stream, you need to specify a trailing '/' on
|
|
282 |
directories passed to the --includes option. If multiple files or
|
|
283 |
directories are given, the new root is the deepest common directory.
|
|
284 |
||
285 |
To specify standard input as the input stream, use a source
|
|
286 |
name of '-'.
|
|
287 |
||
288 |
Note: If a path has been renamed, take care to specify the *original*
|
|
289 |
path name, not the final name that it ends up with.
|
|
290 |
||
|
0.64.201
by Ian Clatworthy
tweak help formatting |
291 |
:Examples:
|
292 |
||
293 |
Create a new project from a library (note the trailing / on the
|
|
294 |
directory name of the library)::
|
|
295 |
||
296 |
front-end | bzr fast-import-filter -i lib/xxx/ > xxx.fi
|
|
297 |
bzr init-repo mylibrary
|
|
298 |
cd mylibrary
|
|
299 |
bzr fast-import ../xxx.fi
|
|
300 |
(lib/xxx/foo is now foo)
|
|
301 |
||
302 |
Create a new repository without a sensitive file::
|
|
303 |
||
304 |
front-end | bzr fast-import-filter -x missile-codes.txt > clean.fi
|
|
305 |
bzr init-repo project.clean
|
|
306 |
cd project.clean
|
|
307 |
bzr fast-import ../clean.fi
|
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
308 |
"""
|
309 |
hidden = False |
|
310 |
_see_also = ['fast-import'] |
|
311 |
takes_args = ['source'] |
|
312 |
takes_options = ['verbose', |
|
|
0.77.5
by Ian Clatworthy
add _paths to option & params names as other types of filtering may be added later |
313 |
ListOption('include_paths', short_name='i', type=str, |
314 |
help="Only include commits affecting these paths." |
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
315 |
" Directories should have a trailing /."
|
316 |
),
|
|
|
0.77.5
by Ian Clatworthy
add _paths to option & params names as other types of filtering may be added later |
317 |
ListOption('exclude_paths', short_name='x', type=str, |
318 |
help="Exclude these paths from commits." |
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
319 |
),
|
320 |
]
|
|
321 |
aliases = [] |
|
|
0.77.17
by Alexander Belchenko
fast-import-filter should produce binary output. |
322 |
encoding_type = 'exact' |
|
0.77.5
by Ian Clatworthy
add _paths to option & params names as other types of filtering may be added later |
323 |
def run(self, source, verbose=False, include_paths=None, |
324 |
exclude_paths=None): |
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
325 |
from bzrlib.plugins.fastimport.processors import filter_processor |
326 |
params = { |
|
|
0.77.5
by Ian Clatworthy
add _paths to option & params names as other types of filtering may be added later |
327 |
'include_paths': include_paths, |
328 |
'exclude_paths': exclude_paths, |
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
329 |
}
|
330 |
return _run(source, filter_processor.FilterProcessor, None, params, |
|
331 |
verbose) |
|
332 |
||
333 |
||
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
334 |
class cmd_fast_import_info(Command): |
335 |
"""Output information about a fast-import stream. |
|
336 |
||
337 |
This command reads a fast-import stream and outputs
|
|
338 |
statistics and interesting properties about what it finds.
|
|
339 |
When run in verbose mode, the information is output as a
|
|
340 |
configuration file that can be passed to fast-import to
|
|
341 |
assist it in intelligently caching objects.
|
|
342 |
||
343 |
To specify standard input as the input stream, use a source
|
|
344 |
name of '-'.
|
|
345 |
||
|
0.64.201
by Ian Clatworthy
tweak help formatting |
346 |
:Examples:
|
347 |
||
348 |
Display statistics about the import stream produced by front-end::
|
|
349 |
||
350 |
front-end | bzr fast-import-info -
|
|
351 |
||
352 |
Create a hints file for running fast-import on a large repository::
|
|
353 |
||
354 |
front-end | bzr fast-import-info -v - > front-end.cfg
|
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
355 |
"""
|
|
0.64.120
by Ian Clatworthy
unhide fast-import and fast-import-info commands |
356 |
hidden = False |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
357 |
_see_also = ['fast-import'] |
358 |
takes_args = ['source'] |
|
359 |
takes_options = ['verbose'] |
|
360 |
aliases = [] |
|
361 |
def run(self, source, verbose=False): |
|
362 |
from bzrlib.plugins.fastimport.processors import info_processor |
|
363 |
return _run(source, info_processor.InfoProcessor, None, {}, verbose) |
|
364 |
||
365 |
||
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
366 |
class cmd_fast_import_query(Command): |
367 |
"""Query a fast-import stream displaying selected commands. |
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
368 |
|
369 |
To specify standard input as the input stream, use a source
|
|
370 |
name of '-'. To specify the commands to display, use the -C
|
|
371 |
option one or more times. To specify just some fields for
|
|
372 |
a command, use the syntax::
|
|
373 |
||
374 |
command=field1,...
|
|
375 |
||
376 |
By default, the nominated fields for the nominated commands
|
|
377 |
are displayed tab separated. To see the information in
|
|
378 |
a name:value format, use verbose mode.
|
|
379 |
||
380 |
Note: Binary fields (e.g. data for blobs) are masked out
|
|
381 |
so it is generally safe to view the output in a terminal.
|
|
382 |
||
|
0.64.201
by Ian Clatworthy
tweak help formatting |
383 |
:Examples:
|
384 |
||
385 |
Show all the fields of the reset and tag commands::
|
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
386 |
|
387 |
front-end > xxx.fi
|
|
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
388 |
bzr fast-import-query xxx.fi -Creset -Ctag
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
389 |
|
|
0.64.201
by Ian Clatworthy
tweak help formatting |
390 |
Show the mark and merge fields of the commit commands::
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
391 |
|
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
392 |
bzr fast-import-query xxx.fi -Ccommit=mark,merge
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
393 |
"""
|
394 |
hidden = True |
|
|
0.64.120
by Ian Clatworthy
unhide fast-import and fast-import-info commands |
395 |
_see_also = ['fast-import', 'fast-import-filter'] |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
396 |
takes_args = ['source'] |
397 |
takes_options = ['verbose', |
|
398 |
ListOption('commands', short_name='C', type=str, |
|
399 |
help="Display fields for these commands." |
|
400 |
),
|
|
401 |
]
|
|
402 |
aliases = [] |
|
403 |
def run(self, source, verbose=False, commands=None): |
|
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
404 |
from bzrlib.plugins.fastimport.processors import query_processor |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
405 |
from bzrlib.plugins.fastimport import helpers |
406 |
params = helpers.defines_to_dict(commands) |
|
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
407 |
return _run(source, query_processor.QueryProcessor, None, params, |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
408 |
verbose) |
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
409 |
|
410 |
||
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
411 |
class cmd_fast_export(Command): |
412 |
"""Generate a fast-import stream from a Bazaar branch. |
|
413 |
||
414 |
This program generates a stream from a bzr branch in the format required by
|
|
415 |
git-fast-import(1). It preserves merges correctly, even merged branches with
|
|
416 |
no common history (`bzr merge -r 0..-1`).
|
|
417 |
||
|
0.64.201
by Ian Clatworthy
tweak help formatting |
418 |
:Examples:
|
419 |
||
420 |
To import several unmerged but related branches into the same repository,
|
|
421 |
use the --{export,import}-marks options, and specify a name for the git
|
|
422 |
branch like this::
|
|
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
423 |
|
|
0.64.201
by Ian Clatworthy
tweak help formatting |
424 |
bzr fast-export --export-marks=marks.bzr project.dev |
|
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
425 |
GIT_DIR=project/.git git-fast-import --export-marks=marks.git
|
426 |
||
|
0.64.201
by Ian Clatworthy
tweak help formatting |
427 |
bzr fast-export --import-marks=marks.bzr -b other project.other |
|
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
428 |
GIT_DIR=project/.git git-fast-import --import-marks=marks.git
|
|
0.79.10
by Ian Clatworthy
documentation clean-ups |
429 |
|
|
0.64.201
by Ian Clatworthy
tweak help formatting |
430 |
If you get a "Missing space after source" error from git-fast-import,
|
431 |
see the top of the commands.py module for a work-around.
|
|
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
432 |
"""
|
|
0.79.10
by Ian Clatworthy
documentation clean-ups |
433 |
hidden = False |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
434 |
_see_also = ['fast-import', 'fast-import-filter'] |
435 |
takes_args = ['source'] |
|
|
0.64.173
by Ian Clatworthy
add -r option to fast-export |
436 |
takes_options = ['verbose', 'revision', |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
437 |
Option('git-branch', short_name='b', type=str, |
438 |
argname='FILE', |
|
439 |
help='Name of the git branch to create (default=master).' |
|
440 |
),
|
|
441 |
Option('checkpoint', type=int, argname='N', |
|
|
0.64.173
by Ian Clatworthy
add -r option to fast-export |
442 |
help="Checkpoint every N revisions (default=10000)." |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
443 |
),
|
444 |
Option('marks', type=str, argname='FILE', |
|
445 |
help="Import marks from and export marks to file." |
|
446 |
),
|
|
447 |
Option('import-marks', type=str, argname='FILE', |
|
448 |
help="Import marks from file." |
|
449 |
),
|
|
450 |
Option('export-marks', type=str, argname='FILE', |
|
451 |
help="Export marks to file." |
|
452 |
),
|
|
453 |
]
|
|
454 |
aliases = [] |
|
|
0.86.1
by Alexander Belchenko
fast-export should force binary sys.stdout on win32 |
455 |
encoding_type = 'exact' |
|
0.64.173
by Ian Clatworthy
add -r option to fast-export |
456 |
def run(self, source, verbose=False, git_branch="master", checkpoint=10000, |
457 |
marks=None, import_marks=None, export_marks=None, revision=None): |
|
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
458 |
from bzrlib.plugins.fastimport import bzr_exporter |
459 |
||
460 |
if marks: |
|
461 |
import_marks = export_marks = marks |
|
462 |
exporter = bzr_exporter.BzrFastExporter(source, |
|
463 |
git_branch=git_branch, checkpoint=checkpoint, |
|
|
0.64.173
by Ian Clatworthy
add -r option to fast-export |
464 |
import_marks_file=import_marks, export_marks_file=export_marks, |
|
0.64.176
by Ian Clatworthy
faster export of revision range & improved diagnostics in fast-export |
465 |
revision=revision, verbose=verbose) |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
466 |
return exporter.run() |
467 |
||
468 |
||
|
0.64.205
by Ian Clatworthy
added fast-export-to-cvs |
469 |
class cmd_fast_export_from_cvs(Command): |
470 |
"""Generate a fast-import file from a CVS repository. |
|
471 |
||
472 |
Destination is a dump file, typically named xxx.fi where xxx is
|
|
473 |
the name of the project. If '-' is given, standard output is used.
|
|
474 |
||
475 |
cvs2svn 2.3 or later must be installed as its cvs2bzr script is used
|
|
476 |
under the covers to do the export. (If cvs2bzr is not included in
|
|
477 |
cvs2svn yet, grab the branch from
|
|
478 |
https://code.launchpad.net/~ian-clatworthy/+junk/cvs2svn and use it.)
|
|
479 |
|
|
480 |
The source must be the path on your filesystem to the part of the
|
|
481 |
repository you wish to convert. i.e. either that path or a parent
|
|
482 |
directory must contain a CVSROOT subdirectory. The path may point to
|
|
483 |
either the top of a repository or to a path within it. In the latter
|
|
484 |
case, only that project within the repository will be converted.
|
|
485 |
||
486 |
.. note::
|
|
487 |
Remote access to the repository is not sufficient - the path
|
|
488 |
must point into a copy of the repository itself. See
|
|
489 |
http://cvs2svn.tigris.org/faq.html#repoaccess for instructions
|
|
490 |
on how to clone a remote CVS repository locally.
|
|
491 |
||
492 |
By default, the trunk, branches and tags are all exported. If you
|
|
493 |
only want the trunk, use the --trunk-only option.
|
|
494 |
||
495 |
By default, filenames, log messages and author names are expected
|
|
496 |
to be encoded in ascii. Use the --encoding option to specify an
|
|
497 |
alternative. If multiple encodings are used, specify the option
|
|
498 |
multiple times. For a list of valid encoding names, see
|
|
499 |
http://docs.python.org/lib/standard-encodings.html.
|
|
500 |
||
501 |
Windows users need to install GNU sort and use the --sort
|
|
502 |
option to specify its location. GNU sort can be downloaded from
|
|
503 |
http://unxutils.sourceforge.net/.
|
|
504 |
"""
|
|
505 |
hidden = False |
|
506 |
_see_also = ['fast-import', 'fast-import-filter'] |
|
507 |
takes_args = ['source', 'destination'] |
|
508 |
takes_options = ['verbose', |
|
509 |
Option('trunk-only', |
|
510 |
help="Export just the trunk, ignoring tags and branches." |
|
511 |
),
|
|
512 |
ListOption('encoding', type=str, argname='CODEC', |
|
513 |
help="Encoding used for filenames, commit messages " |
|
514 |
"and author names if not ascii."
|
|
515 |
),
|
|
516 |
Option('sort', type=str, argname='PATH', |
|
517 |
help="GNU sort program location if not on the path." |
|
518 |
),
|
|
519 |
]
|
|
520 |
aliases = [] |
|
521 |
encoding_type = 'exact' |
|
522 |
def run(self, source, destination, verbose=False, trunk_only=False, |
|
523 |
encoding=None, sort=None): |
|
524 |
from bzrlib.plugins.fastimport.exporters import fast_export_from |
|
525 |
custom = [] |
|
526 |
if trunk_only: |
|
527 |
custom.append("--trunk-only") |
|
528 |
if encoding: |
|
529 |
for enc in encoding: |
|
530 |
custom.extend(['--encoding', enc]) |
|
531 |
if sort: |
|
532 |
custom.extend(['--sort', sort]) |
|
533 |
fast_export_from(source, destination, 'cvs', verbose, custom) |
|
534 |
||
535 |
||
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
536 |
class cmd_fast_export_from_darcs(Command): |
537 |
"""Generate a fast-import file from a Darcs repository. |
|
538 |
||
|
0.64.202
by Ian Clatworthy
more help tweaks |
539 |
Destination is a dump file, typically named xxx.fi where xxx is
|
540 |
the name of the project. If '-' is given, standard output is used.
|
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
541 |
|
542 |
Darcs 2.2 or later must be installed as various subcommands are
|
|
543 |
used to access the source repository. The source may be a network
|
|
544 |
URL but using a local URL is recommended for performance reasons.
|
|
545 |
"""
|
|
546 |
hidden = False |
|
547 |
_see_also = ['fast-import', 'fast-import-filter'] |
|
548 |
takes_args = ['source', 'destination'] |
|
|
0.93.8
by Ian Clatworthy
add encoding option to fast-export-from-darcs |
549 |
takes_options = ['verbose', |
550 |
Option('encoding', type=str, argname='CODEC', |
|
551 |
help="Encoding used for commit messages if not utf-8." |
|
552 |
),
|
|
553 |
]
|
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
554 |
aliases = [] |
555 |
encoding_type = 'exact' |
|
|
0.93.8
by Ian Clatworthy
add encoding option to fast-export-from-darcs |
556 |
def run(self, source, destination, verbose=False, encoding=None): |
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
557 |
from bzrlib.plugins.fastimport.exporters import fast_export_from |
|
0.93.8
by Ian Clatworthy
add encoding option to fast-export-from-darcs |
558 |
custom = None |
559 |
if encoding is not None: |
|
560 |
custom = ['--encoding', encoding] |
|
561 |
fast_export_from(source, destination, 'darcs', verbose, custom) |
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
562 |
|
563 |
||
564 |
class cmd_fast_export_from_hg(Command): |
|
565 |
"""Generate a fast-import file from a Mercurial repository. |
|
566 |
||
|
0.64.202
by Ian Clatworthy
more help tweaks |
567 |
Destination is a dump file, typically named xxx.fi where xxx is
|
568 |
the name of the project. If '-' is given, standard output is used.
|
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
569 |
|
570 |
Mercurial 1.2 or later must be installed as its libraries are used
|
|
571 |
to access the source repository. Given the APIs currently used,
|
|
572 |
the source repository must be a local file, not a network URL.
|
|
573 |
"""
|
|
574 |
hidden = False |
|
575 |
_see_also = ['fast-import', 'fast-import-filter'] |
|
576 |
takes_args = ['source', 'destination'] |
|
577 |
takes_options = ['verbose'] |
|
578 |
aliases = [] |
|
579 |
encoding_type = 'exact' |
|
580 |
def run(self, source, destination, verbose=False): |
|
581 |
from bzrlib.plugins.fastimport.exporters import fast_export_from |
|
582 |
fast_export_from(source, destination, 'hg', verbose) |
|
583 |
||
584 |
||
585 |
class cmd_fast_export_from_git(Command): |
|
586 |
"""Generate a fast-import file from a Git repository. |
|
587 |
||
|
0.64.202
by Ian Clatworthy
more help tweaks |
588 |
Destination is a dump file, typically named xxx.fi where xxx is
|
589 |
the name of the project. If '-' is given, standard output is used.
|
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
590 |
|
591 |
Git 1.6 or later must be installed as the git fast-export
|
|
592 |
subcommand is used under the covers to generate the stream.
|
|
|
0.93.3
by Ian Clatworthy
implement fast-export-from-git |
593 |
The source must be a local directory.
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
594 |
|
|
0.64.201
by Ian Clatworthy
tweak help formatting |
595 |
.. note::
|
596 |
|
|
597 |
Earlier versions of Git may also work fine but are
|
|
598 |
likely to receive less active support if problems arise.
|
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
599 |
"""
|
600 |
hidden = False |
|
601 |
_see_also = ['fast-import', 'fast-import-filter'] |
|
602 |
takes_args = ['source', 'destination'] |
|
603 |
takes_options = ['verbose'] |
|
604 |
aliases = [] |
|
605 |
encoding_type = 'exact' |
|
606 |
def run(self, source, destination, verbose=False): |
|
607 |
from bzrlib.plugins.fastimport.exporters import fast_export_from |
|
608 |
fast_export_from(source, destination, 'git', verbose) |
|
609 |
||
610 |
||
|
0.64.204
by Ian Clatworthy
added fast-export-from-mnt command |
611 |
class cmd_fast_export_from_mnt(Command): |
612 |
"""Generate a fast-import file from a Monotone repository. |
|
613 |
||
614 |
Destination is a dump file, typically named xxx.fi where xxx is
|
|
615 |
the name of the project. If '-' is given, standard output is used.
|
|
616 |
||
617 |
Monotone 0.43 or later must be installed as the mnt git_export
|
|
618 |
subcommand is used under the covers to generate the stream.
|
|
619 |
The source must be a local directory.
|
|
620 |
"""
|
|
621 |
hidden = False |
|
622 |
_see_also = ['fast-import', 'fast-import-filter'] |
|
623 |
takes_args = ['source', 'destination'] |
|
624 |
takes_options = ['verbose'] |
|
625 |
aliases = [] |
|
626 |
encoding_type = 'exact' |
|
627 |
def run(self, source, destination, verbose=False): |
|
628 |
from bzrlib.plugins.fastimport.exporters import fast_export_from |
|
629 |
fast_export_from(source, destination, 'mnt', verbose) |
|
630 |
||
631 |
||
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
632 |
class cmd_fast_export_from_svn(Command): |
633 |
"""Generate a fast-import file from a Subversion repository. |
|
634 |
||
|
0.64.202
by Ian Clatworthy
more help tweaks |
635 |
Destination is a dump file, typically named xxx.fi where xxx is
|
636 |
the name of the project. If '-' is given, standard output is used.
|
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
637 |
|
638 |
Python-Subversion (Python bindings to the Subversion APIs)
|
|
639 |
1.4 or later must be installed as this library is used to
|
|
640 |
access the source repository. The source may be a network URL
|
|
641 |
but using a local URL is recommended for performance reasons.
|
|
642 |
"""
|
|
643 |
hidden = False |
|
644 |
_see_also = ['fast-import', 'fast-import-filter'] |
|
645 |
takes_args = ['source', 'destination'] |
|
|
0.93.11
by Ian Clatworthy
initial cut at fast-export-from-svn |
646 |
takes_options = ['verbose', |
647 |
Option('trunk-path', type=str, argname="STR", |
|
648 |
help="Path in repo to /trunk.\n" |
|
649 |
"May be `regex:/cvs/(trunk)/proj1/(.*)` in "
|
|
650 |
"which case the first group is used as the "
|
|
651 |
"branch name and the second group is used "
|
|
652 |
"to match files.", |
|
653 |
),
|
|
654 |
Option('branches-path', type=str, argname="STR", |
|
655 |
help="Path in repo to /branches." |
|
656 |
),
|
|
657 |
Option('tags-path', type=str, argname="STR", |
|
658 |
help="Path in repo to /tags." |
|
659 |
),
|
|
660 |
]
|
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
661 |
aliases = [] |
662 |
encoding_type = 'exact' |
|
|
0.93.11
by Ian Clatworthy
initial cut at fast-export-from-svn |
663 |
def run(self, source, destination, verbose=False, trunk_path=None, |
664 |
branches_path=None, tags_path=None): |
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
665 |
from bzrlib.plugins.fastimport.exporters import fast_export_from |
|
0.93.11
by Ian Clatworthy
initial cut at fast-export-from-svn |
666 |
custom = [] |
667 |
if trunk_path is not None: |
|
668 |
custom.extend(['--trunk-path', trunk_path]) |
|
669 |
if branches_path is not None: |
|
670 |
custom.extend(['--branches-path', branches_path]) |
|
671 |
if tags_path is not None: |
|
672 |
custom.extend(['--tags-path', tags_path]) |
|
673 |
fast_export_from(source, destination, 'svn', verbose, custom) |
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
674 |
|
675 |
||
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
676 |
register_command(cmd_fast_import) |
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
677 |
register_command(cmd_fast_import_filter) |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
678 |
register_command(cmd_fast_import_info) |
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
679 |
register_command(cmd_fast_import_query) |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
680 |
register_command(cmd_fast_export) |
|
0.64.205
by Ian Clatworthy
added fast-export-to-cvs |
681 |
register_command(cmd_fast_export_from_cvs) |
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
682 |
register_command(cmd_fast_export_from_darcs) |
683 |
register_command(cmd_fast_export_from_hg) |
|
684 |
register_command(cmd_fast_export_from_git) |
|
|
0.64.204
by Ian Clatworthy
added fast-export-from-mnt command |
685 |
register_command(cmd_fast_export_from_mnt) |
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
686 |
register_command(cmd_fast_export_from_svn) |