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 |
||
20 |
The fastimport plugin provides stream-based importing of data into Bazaar.
|
|
21 |
A bzr-fast-export.py script is also included providing exporting of data
|
|
22 |
out of Bazaar to the same format. As well as enabling interchange between
|
|
23 |
multiple VCS tools, fastimport/export can be useful for complex branch
|
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
24 |
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 |
25 |
Source it.
|
26 |
||
27 |
The normal import recipe is::
|
|
28 |
||
29 |
bzr init-repo .
|
|
30 |
front-end | bzr fast-import -
|
|
31 |
||
32 |
Numerous front-ends are provided in the exporters directory where
|
|
33 |
the plugin is installed. The list of known front-ends and their
|
|
34 |
status is documented on http://bazaar-vcs.org/BzrFastImport/FrontEnds.
|
|
35 |
For further details, see http://bazaar-vcs.org/BzrFastImport and the
|
|
36 |
online help for the commands::
|
|
37 |
||
38 |
bzr help fast-import
|
|
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
39 |
bzr help fast-export
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
40 |
bzr help fast-import-filter
|
|
0.64.81
by Ian Clatworthy
'bzr help fastimport' now provides useful help |
41 |
bzr help fast-import-info
|
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
42 |
bzr help fast-import-query
|
|
0.64.81
by Ian Clatworthy
'bzr help fastimport' now provides useful help |
43 |
|
44 |
To report bugs or publish enhancements, visit the bzr-fastimport project
|
|
45 |
page on Launchpad, https://launchpad.net/bzr-fastimport.
|
|
46 |
"""
|
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
47 |
|
|
0.64.126
by Ian Clatworthy
ensure version appears in bzr plugins output (Alexander Belchenko) |
48 |
version_info = (0, 8, 0, 'dev', 0) |
49 |
||
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
50 |
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 |
51 |
from bzrlib.option import Option, ListOption, RegistryOption |
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
52 |
|
53 |
||
54 |
def test_suite(): |
|
55 |
import tests |
|
56 |
return tests.test_suite() |
|
57 |
||
58 |
||
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
59 |
def _run(source, processor_factory, control, params, verbose): |
60 |
"""Create and run a processor. |
|
61 |
|
|
62 |
:param source: a filename or '-' for standard input
|
|
63 |
:param processor_factory: a callable for creating a processor
|
|
64 |
:param control: the BzrDir of the destination or None if no
|
|
65 |
destination is expected
|
|
66 |
"""
|
|
67 |
import parser |
|
68 |
if source == '-': |
|
69 |
import sys |
|
|
0.84.2
by Ian Clatworthy
make sure fast-export uses a binary stream on Windows |
70 |
stream = helpers.binary_stream(sys.stdin) |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
71 |
else: |
|
0.65.6
by James Westby
Open the input in binary mode, as suggested by Paul Moore. |
72 |
stream = open(source, "rb") |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
73 |
proc = processor_factory(control, params=params, verbose=verbose) |
74 |
p = parser.ImportParser(stream, verbose=verbose) |
|
75 |
return proc.process(p.iter_commands) |
|
|
0.64.8
by Ian Clatworthy
custom parameters for processors |
76 |
|
77 |
||
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
78 |
class cmd_fast_import(Command): |
79 |
"""Backend for fast Bazaar data importers. |
|
80 |
||
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
81 |
This command reads a mixed command/data stream and
|
82 |
creates branches in the current repository accordingly.
|
|
83 |
To specify standard input as the input stream, use a
|
|
84 |
source name of '-'.
|
|
85 |
|
|
86 |
The usual recipe is::
|
|
87 |
||
88 |
bzr init-repo .
|
|
89 |
front-end | bzr fast-import -
|
|
90 |
||
91 |
If run inside a branch using a shared repository, then
|
|
92 |
the current branch is made the trunk and other branches,
|
|
93 |
if any, are created in sister directories. If run inside
|
|
94 |
a standalone tree, the current branch is also made the
|
|
95 |
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 |
96 |
|
97 |
Git reference names are mapped to bzr branch names as follows:
|
|
98 |
|
|
99 |
* refs/heads/foo is mapped to foo
|
|
100 |
* refs/remotes/origin/foo is mapped to foo.remote
|
|
101 |
* refs/tags/foo is mapped to foo.tag
|
|
102 |
* */master is mapped to trunk, trunk.remote, etc.
|
|
103 |
* */trunk is mapped to git-trunk, git-trunk.remote, etc.
|
|
104 |
||
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
105 |
The stream format is upwardly compatible with git-fast-import
|
106 |
so existing front-ends for that tool can typically be reused
|
|
107 |
without changes. See http://bazaar-vcs.org/BzrFastImport for
|
|
108 |
links to matching exporters from Subversion, CVS, Git,
|
|
109 |
Mercurial, Darcs, Perforce and SCCS.
|
|
|
0.82.1
by Ian Clatworthy
nicer and round-trippable mapping of git ref names to bzr branch names |
110 |
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
111 |
While reusing an existing format with existing frontends is
|
112 |
great, it does mean a slightly more complex recipe when
|
|
|
0.64.50
by Ian Clatworthy
cleanly restart after an interruption - basic mirroring |
113 |
importing large projects via exporters that reuse blob data
|
114 |
across commits, namely::
|
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
115 |
|
116 |
bzr init-repo .
|
|
117 |
front-end > xxx.fi
|
|
|
0.66.1
by Elliot Murphy
Fix typo in online help. |
118 |
bzr fast-import-info -v xxx.fi > xxx.cfg
|
119 |
bzr fast-import xxx.fi --info xxx.cfg
|
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
120 |
|
121 |
In this scenario, the xxx.cfg file generated by the first pass
|
|
122 |
holds caching hints that the second pass uses to lower memory
|
|
123 |
usage.
|
|
|
0.82.1
by Ian Clatworthy
nicer and round-trippable mapping of git ref names to bzr branch names |
124 |
|
|
0.64.50
by Ian Clatworthy
cleanly restart after an interruption - basic mirroring |
125 |
At checkpoints and on completion, the commit-id -> revision-id
|
126 |
map is saved to a file called 'fastimport-id-map' in the control
|
|
127 |
directory for the repository (e.g. .bzr/repository). If the import
|
|
128 |
is interrupted or unexpectedly crashes, it can be started again
|
|
129 |
and this file will be used to skip over already loaded revisions.
|
|
130 |
As long as subsequent exports from the original source begin
|
|
131 |
with exactly the same revisions, you can use this feature to
|
|
132 |
maintain a mirror of a repository managed by a foreign tool.
|
|
133 |
If and when Bazaar is used to manage the repository, this file
|
|
134 |
can be safely deleted.
|
|
135 |
||
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
136 |
If you wish to write a custom exporter for your project, see
|
137 |
http://bazaar-vcs.org/BzrFastImport for the detailed protocol
|
|
138 |
specification. In many cases, exporters can be written quite
|
|
139 |
quickly using whatever scripting/programming language you like.
|
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
140 |
|
141 |
Examples::
|
|
142 |
||
143 |
cd /git/repo/path
|
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
144 |
git-fast-export --signed-tags=warn | bzr fast-import -
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
145 |
|
146 |
Import a Git repository into Bazaar.
|
|
147 |
||
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
148 |
svn-fast-export.py /svn/repo/path | bzr fast-import -
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
149 |
|
150 |
Import a Subversion repository into Bazaar.
|
|
151 |
||
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
152 |
hg-fast-export.py -r /hg/repo/path | bzr fast-import -
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
153 |
|
154 |
Import a Mercurial repository into Bazaar.
|
|
155 |
"""
|
|
|
0.64.120
by Ian Clatworthy
unhide fast-import and fast-import-info commands |
156 |
hidden = False |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
157 |
_see_also = ['fast-export', 'fast-import-filter', 'fast-import-info'] |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
158 |
takes_args = ['source'] |
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
159 |
takes_options = ['verbose', |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
160 |
Option('info', type=str, |
161 |
help="Path to file containing caching hints.", |
|
162 |
),
|
|
163 |
Option('trees', |
|
164 |
help="Update working trees.", |
|
165 |
),
|
|
166 |
Option('count', type=int, |
|
167 |
help="Import this many revisions then exit.", |
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
168 |
),
|
|
0.64.170
by Ian Clatworthy
add autopack option to fast-import |
169 |
Option('checkpoint', type=int, |
170 |
help="Checkpoint automatically every N revisions." |
|
171 |
" The default is 10000.", |
|
172 |
),
|
|
173 |
Option('autopack', type=int, |
|
174 |
help="Pack every N checkpoints. The default is 4.", |
|
175 |
),
|
|
|
0.64.44
by Ian Clatworthy
smart caching of serialised inventories |
176 |
Option('inv-cache', type=int, |
177 |
help="Number of inventories to cache.", |
|
178 |
),
|
|
|
0.64.171
by Ian Clatworthy
use inv deltas by default for all formats now: --classic to get old algorithm for packs |
179 |
RegistryOption.from_kwargs('mode', |
180 |
'The import algorithm to use.', |
|
181 |
title='Import Algorithm', |
|
182 |
default='Use the preferred algorithm (inventory deltas).', |
|
183 |
classic="Use the original algorithm (mutable inventories).", |
|
184 |
experimental="Enable experimental features.", |
|
185 |
value_switches=True, enum_switch=False, |
|
|
0.64.47
by Ian Clatworthy
add option for enabling experimental stuff |
186 |
),
|
|
0.68.7
by Pieter de Bie
Add importing and exporting of marks to bzr-fastimport |
187 |
Option('import-marks', type=str, |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
188 |
help="Import marks from file." |
189 |
),
|
|
|
0.68.7
by Pieter de Bie
Add importing and exporting of marks to bzr-fastimport |
190 |
Option('export-marks', type=str, |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
191 |
help="Export marks to file." |
192 |
),
|
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
193 |
]
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
194 |
aliases = [] |
195 |
def run(self, source, verbose=False, info=None, trees=False, |
|
|
0.64.170
by Ian Clatworthy
add autopack option to fast-import |
196 |
count=-1, checkpoint=10000, autopack=4, inv_cache=-1, |
|
0.64.171
by Ian Clatworthy
use inv deltas by default for all formats now: --classic to get old algorithm for packs |
197 |
mode=None, import_marks=None, export_marks=None): |
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
198 |
from bzrlib import bzrdir |
|
0.64.135
by Ian Clatworthy
improve error message when .bzr directory not found |
199 |
from bzrlib.errors import BzrCommandError, NotBranchError |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
200 |
from bzrlib.plugins.fastimport.processors import generic_processor |
|
0.64.171
by Ian Clatworthy
use inv deltas by default for all formats now: --classic to get old algorithm for packs |
201 |
if mode is None: |
202 |
mode = 'default' |
|
|
0.64.135
by Ian Clatworthy
improve error message when .bzr directory not found |
203 |
try: |
204 |
control, relpath = bzrdir.BzrDir.open_containing('.') |
|
205 |
except NotBranchError: |
|
206 |
raise BzrCommandError("current directory has no .bzr" |
|
207 |
" directory - use bzr init-repo or bzr init to initialize"
|
|
208 |
" before using bzr fast-import") |
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
209 |
params = { |
210 |
'info': info, |
|
211 |
'trees': trees, |
|
|
0.64.170
by Ian Clatworthy
add autopack option to fast-import |
212 |
'count': count, |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
213 |
'checkpoint': checkpoint, |
|
0.64.170
by Ian Clatworthy
add autopack option to fast-import |
214 |
'autopack': autopack, |
|
0.64.44
by Ian Clatworthy
smart caching of serialised inventories |
215 |
'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 |
216 |
'mode': mode, |
|
0.68.7
by Pieter de Bie
Add importing and exporting of marks to bzr-fastimport |
217 |
'import-marks': import_marks, |
218 |
'export-marks': export_marks, |
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
219 |
}
|
220 |
return _run(source, generic_processor.GenericProcessor, control, |
|
221 |
params, verbose) |
|
222 |
||
223 |
||
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
224 |
class cmd_fast_import_filter(Command): |
225 |
"""Filter a fast-import stream to include/exclude files & directories. |
|
226 |
||
227 |
This command is useful for splitting a subdirectory or bunch of
|
|
228 |
files out from a project to create a new project complete with history
|
|
229 |
for just those files. It can also be used to create a new project
|
|
230 |
repository that removes all references to files that should not have
|
|
231 |
been committed, e.g. security-related information (like passwords),
|
|
232 |
commercially sensitive material, files with an incompatible license or
|
|
233 |
large binary files like CD images.
|
|
234 |
||
235 |
When filtering out a subdirectory (or file), the new stream uses the
|
|
236 |
subdirectory (or subdirectory containing the file) as the root. As
|
|
237 |
fast-import doesn't know in advance whether a path is a file or
|
|
238 |
directory in the stream, you need to specify a trailing '/' on
|
|
239 |
directories passed to the --includes option. If multiple files or
|
|
240 |
directories are given, the new root is the deepest common directory.
|
|
241 |
||
242 |
To specify standard input as the input stream, use a source
|
|
243 |
name of '-'.
|
|
244 |
||
245 |
Note: If a path has been renamed, take care to specify the *original*
|
|
246 |
path name, not the final name that it ends up with.
|
|
247 |
||
248 |
Examples::
|
|
249 |
||
250 |
Create a new project from a library. (Note the trailing / on the
|
|
251 |
directory name of the library.)
|
|
252 |
||
253 |
front-end | bzr fast-import-filter -i lib/xxx/ > xxx.fi
|
|
254 |
bzr init-repo mylibrary
|
|
255 |
cd mylibrary
|
|
256 |
bzr fast-import ../xxx.fi
|
|
257 |
(lib/xxx/foo is now foo)
|
|
258 |
||
259 |
Create a new repository without a sensitive file.
|
|
260 |
||
261 |
front-end | bzr fast-import-filter -x missile-codes.txt > clean.fi
|
|
262 |
bzr init-repo project.clean
|
|
263 |
cd project.clean
|
|
264 |
bzr fast-import ../clean.fi
|
|
265 |
"""
|
|
266 |
hidden = False |
|
267 |
_see_also = ['fast-import'] |
|
268 |
takes_args = ['source'] |
|
269 |
takes_options = ['verbose', |
|
|
0.77.5
by Ian Clatworthy
add _paths to option & params names as other types of filtering may be added later |
270 |
ListOption('include_paths', short_name='i', type=str, |
271 |
help="Only include commits affecting these paths." |
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
272 |
" Directories should have a trailing /."
|
273 |
),
|
|
|
0.77.5
by Ian Clatworthy
add _paths to option & params names as other types of filtering may be added later |
274 |
ListOption('exclude_paths', short_name='x', type=str, |
275 |
help="Exclude these paths from commits." |
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
276 |
),
|
277 |
]
|
|
278 |
aliases = [] |
|
|
0.77.17
by Alexander Belchenko
fast-import-filter should produce binary output. |
279 |
encoding_type = 'exact' |
|
0.77.5
by Ian Clatworthy
add _paths to option & params names as other types of filtering may be added later |
280 |
def run(self, source, verbose=False, include_paths=None, |
281 |
exclude_paths=None): |
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
282 |
from bzrlib.plugins.fastimport.processors import filter_processor |
283 |
params = { |
|
|
0.77.5
by Ian Clatworthy
add _paths to option & params names as other types of filtering may be added later |
284 |
'include_paths': include_paths, |
285 |
'exclude_paths': exclude_paths, |
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
286 |
}
|
287 |
return _run(source, filter_processor.FilterProcessor, None, params, |
|
288 |
verbose) |
|
289 |
||
290 |
||
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
291 |
class cmd_fast_import_info(Command): |
292 |
"""Output information about a fast-import stream. |
|
293 |
||
294 |
This command reads a fast-import stream and outputs
|
|
295 |
statistics and interesting properties about what it finds.
|
|
296 |
When run in verbose mode, the information is output as a
|
|
297 |
configuration file that can be passed to fast-import to
|
|
298 |
assist it in intelligently caching objects.
|
|
299 |
||
300 |
To specify standard input as the input stream, use a source
|
|
301 |
name of '-'.
|
|
302 |
||
303 |
Examples::
|
|
304 |
||
305 |
front-end | bzr fast-import-info -
|
|
306 |
||
307 |
Display statistics about the import stream produced by front-end.
|
|
308 |
||
309 |
front-end | bzr fast-import-info -v - > front-end.cfg
|
|
310 |
||
311 |
Create a hints file for running fast-import on a large repository.
|
|
312 |
"""
|
|
|
0.64.120
by Ian Clatworthy
unhide fast-import and fast-import-info commands |
313 |
hidden = False |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
314 |
_see_also = ['fast-import'] |
315 |
takes_args = ['source'] |
|
316 |
takes_options = ['verbose'] |
|
317 |
aliases = [] |
|
318 |
def run(self, source, verbose=False): |
|
319 |
from bzrlib.plugins.fastimport.processors import info_processor |
|
320 |
return _run(source, info_processor.InfoProcessor, None, {}, verbose) |
|
321 |
||
322 |
||
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
323 |
class cmd_fast_import_query(Command): |
324 |
"""Query a fast-import stream displaying selected commands. |
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
325 |
|
326 |
To specify standard input as the input stream, use a source
|
|
327 |
name of '-'. To specify the commands to display, use the -C
|
|
328 |
option one or more times. To specify just some fields for
|
|
329 |
a command, use the syntax::
|
|
330 |
||
331 |
command=field1,...
|
|
332 |
||
333 |
By default, the nominated fields for the nominated commands
|
|
334 |
are displayed tab separated. To see the information in
|
|
335 |
a name:value format, use verbose mode.
|
|
336 |
||
337 |
Note: Binary fields (e.g. data for blobs) are masked out
|
|
338 |
so it is generally safe to view the output in a terminal.
|
|
339 |
||
340 |
Examples::
|
|
341 |
||
342 |
front-end > xxx.fi
|
|
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
343 |
bzr fast-import-query xxx.fi -Creset -Ctag
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
344 |
|
345 |
Show all the fields of the reset and tag commands.
|
|
346 |
||
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
347 |
bzr fast-import-query xxx.fi -Ccommit=mark,merge
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
348 |
|
349 |
Show the mark and merge fields of the commit commands.
|
|
350 |
"""
|
|
351 |
hidden = True |
|
|
0.64.120
by Ian Clatworthy
unhide fast-import and fast-import-info commands |
352 |
_see_also = ['fast-import', 'fast-import-filter'] |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
353 |
takes_args = ['source'] |
354 |
takes_options = ['verbose', |
|
355 |
ListOption('commands', short_name='C', type=str, |
|
356 |
help="Display fields for these commands." |
|
357 |
),
|
|
358 |
]
|
|
359 |
aliases = [] |
|
360 |
def run(self, source, verbose=False, commands=None): |
|
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
361 |
from bzrlib.plugins.fastimport.processors import query_processor |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
362 |
from bzrlib.plugins.fastimport import helpers |
363 |
params = helpers.defines_to_dict(commands) |
|
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
364 |
return _run(source, query_processor.QueryProcessor, None, params, |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
365 |
verbose) |
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
366 |
|
367 |
||
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
368 |
class cmd_fast_export(Command): |
369 |
"""Generate a fast-import stream from a Bazaar branch. |
|
370 |
||
371 |
This program generates a stream from a bzr branch in the format required by
|
|
372 |
git-fast-import(1). It preserves merges correctly, even merged branches with
|
|
373 |
no common history (`bzr merge -r 0..-1`).
|
|
374 |
||
375 |
To import several unmerged but related branches into the same repository,
|
|
376 |
use the --{export,import}-marks options, and specify a name for the git
|
|
377 |
branch like this::
|
|
378 |
|
|
379 |
% bzr-fast-export --export-marks=marks.bzr project.dev |
|
|
380 |
GIT_DIR=project/.git git-fast-import --export-marks=marks.git
|
|
381 |
||
382 |
% bzr-fast-export --import-marks=marks.bzr -b other project.other |
|
|
383 |
GIT_DIR=project/.git git-fast-import --import-marks=marks.git
|
|
|
0.79.10
by Ian Clatworthy
documentation clean-ups |
384 |
|
385 |
If you get a "Missing space after source" error from git-fast-import,
|
|
386 |
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 |
387 |
"""
|
|
0.79.10
by Ian Clatworthy
documentation clean-ups |
388 |
hidden = False |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
389 |
_see_also = ['fast-import', 'fast-import-filter'] |
390 |
takes_args = ['source'] |
|
|
0.64.173
by Ian Clatworthy
add -r option to fast-export |
391 |
takes_options = ['verbose', 'revision', |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
392 |
Option('git-branch', short_name='b', type=str, |
393 |
argname='FILE', |
|
394 |
help='Name of the git branch to create (default=master).' |
|
395 |
),
|
|
396 |
Option('checkpoint', type=int, argname='N', |
|
|
0.64.173
by Ian Clatworthy
add -r option to fast-export |
397 |
help="Checkpoint every N revisions (default=10000)." |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
398 |
),
|
399 |
Option('marks', type=str, argname='FILE', |
|
400 |
help="Import marks from and export marks to file." |
|
401 |
),
|
|
402 |
Option('import-marks', type=str, argname='FILE', |
|
403 |
help="Import marks from file." |
|
404 |
),
|
|
405 |
Option('export-marks', type=str, argname='FILE', |
|
406 |
help="Export marks to file." |
|
407 |
),
|
|
408 |
]
|
|
409 |
aliases = [] |
|
|
0.86.1
by Alexander Belchenko
fast-export should force binary sys.stdout on win32 |
410 |
encoding_type = 'exact' |
|
0.64.173
by Ian Clatworthy
add -r option to fast-export |
411 |
def run(self, source, verbose=False, git_branch="master", checkpoint=10000, |
412 |
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 |
413 |
from bzrlib.plugins.fastimport import bzr_exporter |
414 |
||
415 |
if marks: |
|
416 |
import_marks = export_marks = marks |
|
417 |
exporter = bzr_exporter.BzrFastExporter(source, |
|
418 |
git_branch=git_branch, checkpoint=checkpoint, |
|
|
0.64.173
by Ian Clatworthy
add -r option to fast-export |
419 |
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 |
420 |
revision=revision, verbose=verbose) |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
421 |
return exporter.run() |
422 |
||
423 |
||
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
424 |
register_command(cmd_fast_import) |
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
425 |
register_command(cmd_fast_import_filter) |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
426 |
register_command(cmd_fast_import_info) |
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
427 |
register_command(cmd_fast_import_query) |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
428 |
register_command(cmd_fast_export) |