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 |
||
49 |
bzr help fast-export-from-darcs
|
|
50 |
bzr help fast-export-from-hg
|
|
51 |
bzr help fast-export-from-git
|
|
52 |
bzr help fast-export-from-svn
|
|
53 |
||
54 |
Once a fast-import dump file is created, it can be imported into a
|
|
55 |
Bazaar repository using the fast-import command. If required, you can
|
|
56 |
manipulate the stream first using the fast-import-filter command.
|
|
57 |
This is useful for creating a repository with just part of a project
|
|
58 |
or for removing large old binaries (say) from history that are no longer
|
|
59 |
valuable to retain. For further details on importing, manipulating and
|
|
60 |
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 |
61 |
|
62 |
bzr help fast-import
|
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
63 |
bzr help fast-import-filter
|
|
0.64.81
by Ian Clatworthy
'bzr help fastimport' now provides useful help |
64 |
bzr help fast-import-info
|
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
65 |
bzr help fast-import-query
|
|
0.64.81
by Ian Clatworthy
'bzr help fastimport' now provides useful help |
66 |
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
67 |
Finally, you may wish to generate a fast-import dump file from a Bazaar
|
68 |
repository. The fast-export command is provided for that purpose.
|
|
69 |
||
|
0.64.81
by Ian Clatworthy
'bzr help fastimport' now provides useful help |
70 |
To report bugs or publish enhancements, visit the bzr-fastimport project
|
71 |
page on Launchpad, https://launchpad.net/bzr-fastimport.
|
|
72 |
"""
|
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
73 |
|
|
0.64.185
by Ian Clatworthy
Open 0.9 development |
74 |
version_info = (0, 9, 0, 'dev', 0) |
|
0.64.126
by Ian Clatworthy
ensure version appears in bzr plugins output (Alexander Belchenko) |
75 |
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
76 |
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 |
77 |
from bzrlib.option import Option, ListOption, RegistryOption |
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
78 |
|
79 |
||
80 |
def test_suite(): |
|
81 |
import tests |
|
82 |
return tests.test_suite() |
|
83 |
||
84 |
||
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
85 |
def _run(source, processor_factory, control, params, verbose): |
86 |
"""Create and run a processor. |
|
87 |
|
|
88 |
:param source: a filename or '-' for standard input
|
|
89 |
:param processor_factory: a callable for creating a processor
|
|
90 |
:param control: the BzrDir of the destination or None if no
|
|
91 |
destination is expected
|
|
92 |
"""
|
|
93 |
import parser |
|
94 |
if source == '-': |
|
95 |
import sys |
|
|
0.84.2
by Ian Clatworthy
make sure fast-export uses a binary stream on Windows |
96 |
stream = helpers.binary_stream(sys.stdin) |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
97 |
else: |
|
0.65.6
by James Westby
Open the input in binary mode, as suggested by Paul Moore. |
98 |
stream = open(source, "rb") |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
99 |
proc = processor_factory(control, params=params, verbose=verbose) |
100 |
p = parser.ImportParser(stream, verbose=verbose) |
|
101 |
return proc.process(p.iter_commands) |
|
|
0.64.8
by Ian Clatworthy
custom parameters for processors |
102 |
|
103 |
||
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
104 |
class cmd_fast_import(Command): |
105 |
"""Backend for fast Bazaar data importers. |
|
106 |
||
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
107 |
This command reads a mixed command/data stream and
|
108 |
creates branches in the current repository accordingly.
|
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
109 |
The usual recipe is::
|
110 |
||
111 |
bzr fast-import project.fi
|
|
112 |
||
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
113 |
To specify standard input as the input stream, use a
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
114 |
source name of '-' (instead of project.fi). Numerous commands
|
115 |
are provided for generating a fast-import stream to use as input.
|
|
116 |
These include fast-export-from-svn, fast-export-from-git,
|
|
117 |
fast-export-from-hg and fast-export-from-darcs.
|
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
118 |
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
119 |
If you wish to write a custom exporter for your project, see
|
120 |
http://bazaar-vcs.org/BzrFastImport for the detailed protocol
|
|
121 |
specification. In many cases, exporters can be written quite
|
|
122 |
quickly using whatever scripting/programming language you like.
|
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
123 |
|
124 |
If run inside a branch using a shared repository, then
|
|
125 |
the current branch is made the trunk and other branches,
|
|
126 |
if any, are created in sister directories. If run inside
|
|
127 |
a standalone tree, the current branch is also made the
|
|
128 |
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 |
129 |
|
130 |
Git reference names are mapped to bzr branch names as follows:
|
|
131 |
|
|
132 |
* refs/heads/foo is mapped to foo
|
|
133 |
* refs/remotes/origin/foo is mapped to foo.remote
|
|
134 |
* refs/tags/foo is mapped to foo.tag
|
|
135 |
* */master is mapped to trunk, trunk.remote, etc.
|
|
136 |
* */trunk is mapped to git-trunk, git-trunk.remote, etc.
|
|
137 |
||
138 |
||
|
0.64.50
by Ian Clatworthy
cleanly restart after an interruption - basic mirroring |
139 |
At checkpoints and on completion, the commit-id -> revision-id
|
140 |
map is saved to a file called 'fastimport-id-map' in the control
|
|
141 |
directory for the repository (e.g. .bzr/repository). If the import
|
|
142 |
is interrupted or unexpectedly crashes, it can be started again
|
|
143 |
and this file will be used to skip over already loaded revisions.
|
|
144 |
As long as subsequent exports from the original source begin
|
|
145 |
with exactly the same revisions, you can use this feature to
|
|
146 |
maintain a mirror of a repository managed by a foreign tool.
|
|
147 |
If and when Bazaar is used to manage the repository, this file
|
|
148 |
can be safely deleted.
|
|
149 |
||
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
150 |
Note: A slightly more complex recipe is required when importing large
|
151 |
projects via exporters that reuse blob data across commits, namely::
|
|
152 |
||
153 |
bzr init-repo .
|
|
154 |
front-end > xxx.fi
|
|
155 |
bzr fast-import-info -v xxx.fi > xxx.cfg
|
|
156 |
bzr fast-import xxx.fi --info xxx.cfg
|
|
157 |
||
158 |
In this scenario, the xxx.cfg file generated by the first pass
|
|
159 |
holds caching hints that the second pass uses to lower memory
|
|
160 |
usage. Development is planned so that this recipe becomes obsolete
|
|
161 |
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 |
162 |
|
|
0.64.201
by Ian Clatworthy
tweak help formatting |
163 |
:Examples:
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
164 |
|
|
0.64.201
by Ian Clatworthy
tweak help formatting |
165 |
Import a Subversion repository into Bazaar::
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
166 |
|
167 |
bzr fast-export-from-svn /svn/repo/path project.fi
|
|
168 |
bzr fast-import project.fi
|
|
169 |
||
|
0.64.201
by Ian Clatworthy
tweak help formatting |
170 |
Import a Git repository into Bazaar::
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
171 |
|
172 |
bzr fast-export-from-git /git/repo/path project.fi
|
|
173 |
bzr fast-import project.fi
|
|
174 |
||
|
0.64.201
by Ian Clatworthy
tweak help formatting |
175 |
Import a Mercurial repository into Bazaar::
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
176 |
|
177 |
bzr fast-export-from-hg /hg/repo/path project.fi
|
|
178 |
bzr fast-import project.fi
|
|
179 |
||
|
0.64.201
by Ian Clatworthy
tweak help formatting |
180 |
Import a Darcs repository into Bazaar::
|
|
0.93.12
by Ian Clatworthy
NEWS item and doco tweaks |
181 |
|
182 |
bzr fast-export-from-darcs /darcs/repo/path project.fi
|
|
183 |
bzr fast-import project.fi
|
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
184 |
"""
|
|
0.64.120
by Ian Clatworthy
unhide fast-import and fast-import-info commands |
185 |
hidden = False |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
186 |
_see_also = ['fast-export', 'fast-import-filter', 'fast-import-info'] |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
187 |
takes_args = ['source'] |
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
188 |
takes_options = ['verbose', |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
189 |
Option('info', type=str, |
190 |
help="Path to file containing caching hints.", |
|
191 |
),
|
|
192 |
Option('trees', |
|
193 |
help="Update working trees.", |
|
194 |
),
|
|
195 |
Option('count', type=int, |
|
196 |
help="Import this many revisions then exit.", |
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
197 |
),
|
|
0.64.170
by Ian Clatworthy
add autopack option to fast-import |
198 |
Option('checkpoint', type=int, |
199 |
help="Checkpoint automatically every N revisions." |
|
200 |
" The default is 10000.", |
|
201 |
),
|
|
202 |
Option('autopack', type=int, |
|
203 |
help="Pack every N checkpoints. The default is 4.", |
|
204 |
),
|
|
|
0.64.44
by Ian Clatworthy
smart caching of serialised inventories |
205 |
Option('inv-cache', type=int, |
206 |
help="Number of inventories to cache.", |
|
207 |
),
|
|
|
0.64.171
by Ian Clatworthy
use inv deltas by default for all formats now: --classic to get old algorithm for packs |
208 |
RegistryOption.from_kwargs('mode', |
209 |
'The import algorithm to use.', |
|
210 |
title='Import Algorithm', |
|
211 |
default='Use the preferred algorithm (inventory deltas).', |
|
212 |
classic="Use the original algorithm (mutable inventories).", |
|
213 |
experimental="Enable experimental features.", |
|
214 |
value_switches=True, enum_switch=False, |
|
|
0.64.47
by Ian Clatworthy
add option for enabling experimental stuff |
215 |
),
|
|
0.68.7
by Pieter de Bie
Add importing and exporting of marks to bzr-fastimport |
216 |
Option('import-marks', type=str, |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
217 |
help="Import marks from file." |
218 |
),
|
|
|
0.68.7
by Pieter de Bie
Add importing and exporting of marks to bzr-fastimport |
219 |
Option('export-marks', type=str, |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
220 |
help="Export marks to file." |
221 |
),
|
|
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
222 |
]
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
223 |
aliases = [] |
224 |
def run(self, source, verbose=False, info=None, trees=False, |
|
|
0.64.170
by Ian Clatworthy
add autopack option to fast-import |
225 |
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 |
226 |
mode=None, import_marks=None, export_marks=None): |
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
227 |
from bzrlib import bzrdir |
|
0.64.135
by Ian Clatworthy
improve error message when .bzr directory not found |
228 |
from bzrlib.errors import BzrCommandError, NotBranchError |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
229 |
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 |
230 |
if mode is None: |
231 |
mode = 'default' |
|
|
0.64.135
by Ian Clatworthy
improve error message when .bzr directory not found |
232 |
try: |
233 |
control, relpath = bzrdir.BzrDir.open_containing('.') |
|
234 |
except NotBranchError: |
|
235 |
raise BzrCommandError("current directory has no .bzr" |
|
236 |
" directory - use bzr init-repo or bzr init to initialize"
|
|
237 |
" before using bzr fast-import") |
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
238 |
params = { |
239 |
'info': info, |
|
240 |
'trees': trees, |
|
|
0.64.170
by Ian Clatworthy
add autopack option to fast-import |
241 |
'count': count, |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
242 |
'checkpoint': checkpoint, |
|
0.64.170
by Ian Clatworthy
add autopack option to fast-import |
243 |
'autopack': autopack, |
|
0.64.44
by Ian Clatworthy
smart caching of serialised inventories |
244 |
'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 |
245 |
'mode': mode, |
|
0.68.7
by Pieter de Bie
Add importing and exporting of marks to bzr-fastimport |
246 |
'import-marks': import_marks, |
247 |
'export-marks': export_marks, |
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
248 |
}
|
249 |
return _run(source, generic_processor.GenericProcessor, control, |
|
250 |
params, verbose) |
|
251 |
||
252 |
||
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
253 |
class cmd_fast_import_filter(Command): |
254 |
"""Filter a fast-import stream to include/exclude files & directories. |
|
255 |
||
256 |
This command is useful for splitting a subdirectory or bunch of
|
|
257 |
files out from a project to create a new project complete with history
|
|
258 |
for just those files. It can also be used to create a new project
|
|
259 |
repository that removes all references to files that should not have
|
|
260 |
been committed, e.g. security-related information (like passwords),
|
|
261 |
commercially sensitive material, files with an incompatible license or
|
|
262 |
large binary files like CD images.
|
|
263 |
||
264 |
When filtering out a subdirectory (or file), the new stream uses the
|
|
265 |
subdirectory (or subdirectory containing the file) as the root. As
|
|
266 |
fast-import doesn't know in advance whether a path is a file or
|
|
267 |
directory in the stream, you need to specify a trailing '/' on
|
|
268 |
directories passed to the --includes option. If multiple files or
|
|
269 |
directories are given, the new root is the deepest common directory.
|
|
270 |
||
271 |
To specify standard input as the input stream, use a source
|
|
272 |
name of '-'.
|
|
273 |
||
274 |
Note: If a path has been renamed, take care to specify the *original*
|
|
275 |
path name, not the final name that it ends up with.
|
|
276 |
||
|
0.64.201
by Ian Clatworthy
tweak help formatting |
277 |
:Examples:
|
278 |
||
279 |
Create a new project from a library (note the trailing / on the
|
|
280 |
directory name of the library)::
|
|
281 |
||
282 |
front-end | bzr fast-import-filter -i lib/xxx/ > xxx.fi
|
|
283 |
bzr init-repo mylibrary
|
|
284 |
cd mylibrary
|
|
285 |
bzr fast-import ../xxx.fi
|
|
286 |
(lib/xxx/foo is now foo)
|
|
287 |
||
288 |
Create a new repository without a sensitive file::
|
|
289 |
||
290 |
front-end | bzr fast-import-filter -x missile-codes.txt > clean.fi
|
|
291 |
bzr init-repo project.clean
|
|
292 |
cd project.clean
|
|
293 |
bzr fast-import ../clean.fi
|
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
294 |
"""
|
295 |
hidden = False |
|
296 |
_see_also = ['fast-import'] |
|
297 |
takes_args = ['source'] |
|
298 |
takes_options = ['verbose', |
|
|
0.77.5
by Ian Clatworthy
add _paths to option & params names as other types of filtering may be added later |
299 |
ListOption('include_paths', short_name='i', type=str, |
300 |
help="Only include commits affecting these paths." |
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
301 |
" Directories should have a trailing /."
|
302 |
),
|
|
|
0.77.5
by Ian Clatworthy
add _paths to option & params names as other types of filtering may be added later |
303 |
ListOption('exclude_paths', short_name='x', type=str, |
304 |
help="Exclude these paths from commits." |
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
305 |
),
|
306 |
]
|
|
307 |
aliases = [] |
|
|
0.77.17
by Alexander Belchenko
fast-import-filter should produce binary output. |
308 |
encoding_type = 'exact' |
|
0.77.5
by Ian Clatworthy
add _paths to option & params names as other types of filtering may be added later |
309 |
def run(self, source, verbose=False, include_paths=None, |
310 |
exclude_paths=None): |
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
311 |
from bzrlib.plugins.fastimport.processors import filter_processor |
312 |
params = { |
|
|
0.77.5
by Ian Clatworthy
add _paths to option & params names as other types of filtering may be added later |
313 |
'include_paths': include_paths, |
314 |
'exclude_paths': exclude_paths, |
|
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
315 |
}
|
316 |
return _run(source, filter_processor.FilterProcessor, None, params, |
|
317 |
verbose) |
|
318 |
||
319 |
||
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
320 |
class cmd_fast_import_info(Command): |
321 |
"""Output information about a fast-import stream. |
|
322 |
||
323 |
This command reads a fast-import stream and outputs
|
|
324 |
statistics and interesting properties about what it finds.
|
|
325 |
When run in verbose mode, the information is output as a
|
|
326 |
configuration file that can be passed to fast-import to
|
|
327 |
assist it in intelligently caching objects.
|
|
328 |
||
329 |
To specify standard input as the input stream, use a source
|
|
330 |
name of '-'.
|
|
331 |
||
|
0.64.201
by Ian Clatworthy
tweak help formatting |
332 |
:Examples:
|
333 |
||
334 |
Display statistics about the import stream produced by front-end::
|
|
335 |
||
336 |
front-end | bzr fast-import-info -
|
|
337 |
||
338 |
Create a hints file for running fast-import on a large repository::
|
|
339 |
||
340 |
front-end | bzr fast-import-info -v - > front-end.cfg
|
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
341 |
"""
|
|
0.64.120
by Ian Clatworthy
unhide fast-import and fast-import-info commands |
342 |
hidden = False |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
343 |
_see_also = ['fast-import'] |
344 |
takes_args = ['source'] |
|
345 |
takes_options = ['verbose'] |
|
346 |
aliases = [] |
|
347 |
def run(self, source, verbose=False): |
|
348 |
from bzrlib.plugins.fastimport.processors import info_processor |
|
349 |
return _run(source, info_processor.InfoProcessor, None, {}, verbose) |
|
350 |
||
351 |
||
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
352 |
class cmd_fast_import_query(Command): |
353 |
"""Query a fast-import stream displaying selected commands. |
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
354 |
|
355 |
To specify standard input as the input stream, use a source
|
|
356 |
name of '-'. To specify the commands to display, use the -C
|
|
357 |
option one or more times. To specify just some fields for
|
|
358 |
a command, use the syntax::
|
|
359 |
||
360 |
command=field1,...
|
|
361 |
||
362 |
By default, the nominated fields for the nominated commands
|
|
363 |
are displayed tab separated. To see the information in
|
|
364 |
a name:value format, use verbose mode.
|
|
365 |
||
366 |
Note: Binary fields (e.g. data for blobs) are masked out
|
|
367 |
so it is generally safe to view the output in a terminal.
|
|
368 |
||
|
0.64.201
by Ian Clatworthy
tweak help formatting |
369 |
:Examples:
|
370 |
||
371 |
Show all the fields of the reset and tag commands::
|
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
372 |
|
373 |
front-end > xxx.fi
|
|
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
374 |
bzr fast-import-query xxx.fi -Creset -Ctag
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
375 |
|
|
0.64.201
by Ian Clatworthy
tweak help formatting |
376 |
Show the mark and merge fields of the commit commands::
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
377 |
|
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
378 |
bzr fast-import-query xxx.fi -Ccommit=mark,merge
|
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
379 |
"""
|
380 |
hidden = True |
|
|
0.64.120
by Ian Clatworthy
unhide fast-import and fast-import-info commands |
381 |
_see_also = ['fast-import', 'fast-import-filter'] |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
382 |
takes_args = ['source'] |
383 |
takes_options = ['verbose', |
|
384 |
ListOption('commands', short_name='C', type=str, |
|
385 |
help="Display fields for these commands." |
|
386 |
),
|
|
387 |
]
|
|
388 |
aliases = [] |
|
389 |
def run(self, source, verbose=False, commands=None): |
|
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
390 |
from bzrlib.plugins.fastimport.processors import query_processor |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
391 |
from bzrlib.plugins.fastimport import helpers |
392 |
params = helpers.defines_to_dict(commands) |
|
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
393 |
return _run(source, query_processor.QueryProcessor, None, params, |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
394 |
verbose) |
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
395 |
|
396 |
||
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
397 |
class cmd_fast_export(Command): |
398 |
"""Generate a fast-import stream from a Bazaar branch. |
|
399 |
||
400 |
This program generates a stream from a bzr branch in the format required by
|
|
401 |
git-fast-import(1). It preserves merges correctly, even merged branches with
|
|
402 |
no common history (`bzr merge -r 0..-1`).
|
|
403 |
||
|
0.64.201
by Ian Clatworthy
tweak help formatting |
404 |
:Examples:
|
405 |
||
406 |
To import several unmerged but related branches into the same repository,
|
|
407 |
use the --{export,import}-marks options, and specify a name for the git
|
|
408 |
branch like this::
|
|
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
409 |
|
|
0.64.201
by Ian Clatworthy
tweak help formatting |
410 |
bzr fast-export --export-marks=marks.bzr project.dev |
|
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
411 |
GIT_DIR=project/.git git-fast-import --export-marks=marks.git
|
412 |
||
|
0.64.201
by Ian Clatworthy
tweak help formatting |
413 |
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 |
414 |
GIT_DIR=project/.git git-fast-import --import-marks=marks.git
|
|
0.79.10
by Ian Clatworthy
documentation clean-ups |
415 |
|
|
0.64.201
by Ian Clatworthy
tweak help formatting |
416 |
If you get a "Missing space after source" error from git-fast-import,
|
417 |
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 |
418 |
"""
|
|
0.79.10
by Ian Clatworthy
documentation clean-ups |
419 |
hidden = False |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
420 |
_see_also = ['fast-import', 'fast-import-filter'] |
421 |
takes_args = ['source'] |
|
|
0.64.173
by Ian Clatworthy
add -r option to fast-export |
422 |
takes_options = ['verbose', 'revision', |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
423 |
Option('git-branch', short_name='b', type=str, |
424 |
argname='FILE', |
|
425 |
help='Name of the git branch to create (default=master).' |
|
426 |
),
|
|
427 |
Option('checkpoint', type=int, argname='N', |
|
|
0.64.173
by Ian Clatworthy
add -r option to fast-export |
428 |
help="Checkpoint every N revisions (default=10000)." |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
429 |
),
|
430 |
Option('marks', type=str, argname='FILE', |
|
431 |
help="Import marks from and export marks to file." |
|
432 |
),
|
|
433 |
Option('import-marks', type=str, argname='FILE', |
|
434 |
help="Import marks from file." |
|
435 |
),
|
|
436 |
Option('export-marks', type=str, argname='FILE', |
|
437 |
help="Export marks to file." |
|
438 |
),
|
|
439 |
]
|
|
440 |
aliases = [] |
|
|
0.86.1
by Alexander Belchenko
fast-export should force binary sys.stdout on win32 |
441 |
encoding_type = 'exact' |
|
0.64.173
by Ian Clatworthy
add -r option to fast-export |
442 |
def run(self, source, verbose=False, git_branch="master", checkpoint=10000, |
443 |
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 |
444 |
from bzrlib.plugins.fastimport import bzr_exporter |
445 |
||
446 |
if marks: |
|
447 |
import_marks = export_marks = marks |
|
448 |
exporter = bzr_exporter.BzrFastExporter(source, |
|
449 |
git_branch=git_branch, checkpoint=checkpoint, |
|
|
0.64.173
by Ian Clatworthy
add -r option to fast-export |
450 |
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 |
451 |
revision=revision, verbose=verbose) |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
452 |
return exporter.run() |
453 |
||
454 |
||
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
455 |
class cmd_fast_export_from_darcs(Command): |
456 |
"""Generate a fast-import file from a Darcs repository. |
|
457 |
||
458 |
If '-' is given as the destination, standard output is used.
|
|
459 |
||
460 |
Darcs 2.2 or later must be installed as various subcommands are
|
|
461 |
used to access the source repository. The source may be a network
|
|
462 |
URL but using a local URL is recommended for performance reasons.
|
|
463 |
"""
|
|
464 |
hidden = False |
|
465 |
_see_also = ['fast-import', 'fast-import-filter'] |
|
466 |
takes_args = ['source', 'destination'] |
|
|
0.93.8
by Ian Clatworthy
add encoding option to fast-export-from-darcs |
467 |
takes_options = ['verbose', |
468 |
Option('encoding', type=str, argname='CODEC', |
|
469 |
help="Encoding used for commit messages if not utf-8." |
|
470 |
),
|
|
471 |
]
|
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
472 |
aliases = [] |
473 |
encoding_type = 'exact' |
|
|
0.93.8
by Ian Clatworthy
add encoding option to fast-export-from-darcs |
474 |
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 |
475 |
from bzrlib.plugins.fastimport.exporters import fast_export_from |
|
0.93.8
by Ian Clatworthy
add encoding option to fast-export-from-darcs |
476 |
custom = None |
477 |
if encoding is not None: |
|
478 |
custom = ['--encoding', encoding] |
|
479 |
fast_export_from(source, destination, 'darcs', verbose, custom) |
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
480 |
|
481 |
||
482 |
class cmd_fast_export_from_hg(Command): |
|
483 |
"""Generate a fast-import file from a Mercurial repository. |
|
484 |
||
485 |
If '-' is given as the destination, standard output is used.
|
|
486 |
||
487 |
Mercurial 1.2 or later must be installed as its libraries are used
|
|
488 |
to access the source repository. Given the APIs currently used,
|
|
489 |
the source repository must be a local file, not a network URL.
|
|
490 |
"""
|
|
491 |
hidden = False |
|
492 |
_see_also = ['fast-import', 'fast-import-filter'] |
|
493 |
takes_args = ['source', 'destination'] |
|
494 |
takes_options = ['verbose'] |
|
495 |
aliases = [] |
|
496 |
encoding_type = 'exact' |
|
497 |
def run(self, source, destination, verbose=False): |
|
498 |
from bzrlib.plugins.fastimport.exporters import fast_export_from |
|
499 |
fast_export_from(source, destination, 'hg', verbose) |
|
500 |
||
501 |
||
502 |
class cmd_fast_export_from_git(Command): |
|
503 |
"""Generate a fast-import file from a Git repository. |
|
504 |
||
505 |
If '-' is given as the destination, standard output is used.
|
|
506 |
||
507 |
Git 1.6 or later must be installed as the git fast-export
|
|
508 |
subcommand is used under the covers to generate the stream.
|
|
|
0.93.3
by Ian Clatworthy
implement fast-export-from-git |
509 |
The source must be a local directory.
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
510 |
|
|
0.64.201
by Ian Clatworthy
tweak help formatting |
511 |
.. note::
|
512 |
|
|
513 |
Earlier versions of Git may also work fine but are
|
|
514 |
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 |
515 |
"""
|
516 |
hidden = False |
|
517 |
_see_also = ['fast-import', 'fast-import-filter'] |
|
518 |
takes_args = ['source', 'destination'] |
|
519 |
takes_options = ['verbose'] |
|
520 |
aliases = [] |
|
521 |
encoding_type = 'exact' |
|
522 |
def run(self, source, destination, verbose=False): |
|
523 |
from bzrlib.plugins.fastimport.exporters import fast_export_from |
|
524 |
fast_export_from(source, destination, 'git', verbose) |
|
525 |
||
526 |
||
527 |
class cmd_fast_export_from_svn(Command): |
|
528 |
"""Generate a fast-import file from a Subversion repository. |
|
529 |
||
530 |
If '-' is given as the destination, standard output is used.
|
|
531 |
||
532 |
Python-Subversion (Python bindings to the Subversion APIs)
|
|
533 |
1.4 or later must be installed as this library is used to
|
|
534 |
access the source repository. The source may be a network URL
|
|
535 |
but using a local URL is recommended for performance reasons.
|
|
536 |
"""
|
|
537 |
hidden = False |
|
538 |
_see_also = ['fast-import', 'fast-import-filter'] |
|
539 |
takes_args = ['source', 'destination'] |
|
|
0.93.11
by Ian Clatworthy
initial cut at fast-export-from-svn |
540 |
takes_options = ['verbose', |
541 |
Option('trunk-path', type=str, argname="STR", |
|
542 |
help="Path in repo to /trunk.\n" |
|
543 |
"May be `regex:/cvs/(trunk)/proj1/(.*)` in "
|
|
544 |
"which case the first group is used as the "
|
|
545 |
"branch name and the second group is used "
|
|
546 |
"to match files.", |
|
547 |
),
|
|
548 |
Option('branches-path', type=str, argname="STR", |
|
549 |
help="Path in repo to /branches." |
|
550 |
),
|
|
551 |
Option('tags-path', type=str, argname="STR", |
|
552 |
help="Path in repo to /tags." |
|
553 |
),
|
|
554 |
]
|
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
555 |
aliases = [] |
556 |
encoding_type = 'exact' |
|
|
0.93.11
by Ian Clatworthy
initial cut at fast-export-from-svn |
557 |
def run(self, source, destination, verbose=False, trunk_path=None, |
558 |
branches_path=None, tags_path=None): |
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
559 |
from bzrlib.plugins.fastimport.exporters import fast_export_from |
|
0.93.11
by Ian Clatworthy
initial cut at fast-export-from-svn |
560 |
custom = [] |
561 |
if trunk_path is not None: |
|
562 |
custom.extend(['--trunk-path', trunk_path]) |
|
563 |
if branches_path is not None: |
|
564 |
custom.extend(['--branches-path', branches_path]) |
|
565 |
if tags_path is not None: |
|
566 |
custom.extend(['--tags-path', tags_path]) |
|
567 |
fast_export_from(source, destination, 'svn', verbose, custom) |
|
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
568 |
|
569 |
||
|
0.64.1
by Ian Clatworthy
1st cut: gfi parser + --info processing method |
570 |
register_command(cmd_fast_import) |
|
0.77.1
by Ian Clatworthy
initial cut at fast-import-filter |
571 |
register_command(cmd_fast_import_filter) |
|
0.64.38
by Ian Clatworthy
clean-up doc ready for initial release |
572 |
register_command(cmd_fast_import_info) |
|
0.64.111
by Ian Clatworthy
rename fast-import-filter to fast-import-query |
573 |
register_command(cmd_fast_import_query) |
|
0.79.1
by Ian Clatworthy
turn bzr-fast-export into a fast-export command |
574 |
register_command(cmd_fast_export) |
|
0.93.1
by Ian Clatworthy
initial cut at a simplified ui to xxx-fast-export |
575 |
register_command(cmd_fast_export_from_darcs) |
576 |
register_command(cmd_fast_export_from_hg) |
|
577 |
register_command(cmd_fast_export_from_git) |
|
578 |
register_command(cmd_fast_export_from_svn) |