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