~jelmer/bzr-svn/svn-1.5

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Jelmer Vernooij
  • Date: 2008-07-21 19:56:11 UTC
  • mfrom: (1196.1.286 0.4)
  • Revision ID: jelmer@samba.org-20080721195611-xmm0tffdmmwooye9
mergeĀ 0.4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
"""
18
 
Support for Subversion branches
 
17
"""Support for Subversion branches
 
18
 
 
19
Bazaar can be used with Subversion branches through the bzr-svn plugin.
 
20
 
 
21
Most Bazaar commands should work fine with Subversion branches. The following 
 
22
commands at the moment do not:
 
23
 
 
24
 - bzr uncommit
 
25
 - bzr push --overwrite
 
26
 
 
27
bzr-svn also adds two new commands to Bazaar:
 
28
 
 
29
 - bzr svn-import
 
30
 - bzr dpush
 
31
 
 
32
For more information about bzr-svn, see the bzr-svn FAQ.
 
33
 
19
34
"""
20
35
import bzrlib
 
36
from bzrlib import log
21
37
from bzrlib.bzrdir import BzrDirFormat, format_registry
22
38
from bzrlib.errors import BzrError
23
39
from bzrlib.commands import Command, register_command, display_command, Option
141
157
                         native=False, hidden=True)
142
158
SPEC_TYPES.append(revspec.RevisionSpec_svn)
143
159
 
 
160
if getattr(log, "properties_handler_registry", None) is not None:
 
161
    log.properties_handler_registry.register_lazy("subversion",
 
162
                                                  "bzrlib.plugins.svn.log",
 
163
                                                  "show_subversion_properties")
 
164
 
144
165
versions_checked = False
145
166
def lazy_check_versions():
146
167
    """Check whether all dependencies have the right versions.
187
208
class cmd_svn_import(Command):
188
209
    """Convert a Subversion repository to a Bazaar repository.
189
210
    
 
211
    To save disk space, only branches will be created by default 
 
212
    (no working trees). To create a tree for a branch, run "bzr co" in 
 
213
    it.
190
214
    """
191
215
    takes_args = ['from_location', 'to_location?']
192
216
    takes_options = [Option('trees', help='Create working trees.'),
240
264
            from_repos = from_dir.find_repository()
241
265
            prefix = urlutils.relative_url(from_repos.base, from_location)
242
266
            prefix = prefix.encode("utf-8")
243
 
            self.outf.write("Importing branches with prefix %s\n" % 
244
 
                    urlutils.unescape_for_display(prefix, self.outf.encoding))
245
267
 
246
268
        from_repos.lock_read()
247
269
        try:
248
 
            scheme = repository_guess_scheme(from_repos, from_repos.get_latest_revnum())
 
270
            (guessed_scheme, scheme) = repository_guess_scheme(from_repos, from_repos.get_latest_revnum())
249
271
 
250
272
            if prefix is not None:
251
273
                prefix = prefix.strip("/") + "/"
252
 
                if scheme.is_branch(prefix):
 
274
                if guessed_scheme.is_branch(prefix):
253
275
                    raise BzrCommandError("%s appears to contain a branch. " 
254
276
                            "For individual branches, use 'bzr branch'." % from_location)
255
277
 
 
278
                self.outf.write("Importing branches with prefix /%s\n" % 
 
279
                    urlutils.unescape_for_display(prefix, self.outf.encoding))
 
280
 
256
281
            if not isinstance(from_repos, SvnRepository):
257
282
                raise BzrCommandError(
258
283
                        "Not a Subversion repository: %s" % from_location)
446
471
            revno, old_last_revid = source_branch.last_revision_info()
447
472
            new_last_revid = revid_map[old_last_revid]
448
473
            if source_wt is not None:
449
 
                source_wt.pull(target_branch, overwrite=True, stop_revision=new_last_revid)
 
474
                source_wt.pull(target_branch, overwrite=True, 
 
475
                               stop_revision=new_last_revid)
450
476
            else:
451
 
                source_branch.pull(target_branch, overwrite=True, stop_revision=new_last_revid)
 
477
                source_branch.pull(target_branch, overwrite=True, 
 
478
                                   stop_revision=new_last_revid)
452
479
 
453
480
 
454
481
register_command(cmd_dpush)
495
522
            if repository_wide:
496
523
                set_property_scheme(repos, scheme)
497
524
            else:
498
 
                config_set_scheme(repos, scheme, mandatory=True)
 
525
                config_set_scheme(repos, scheme, None, mandatory=True)
499
526
        elif scheme is not None:
500
527
            info(scheme_str(scheme))
501
528