/breezy/trunk

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/trunk

« back to all changes in this revision

Viewing changes to breezy/builtins.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-23 22:06:41 UTC
  • mfrom: (6738 trunk)
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723220641-69eczax9bmv8d6kk
Merge trunk, address review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import os
23
23
import sys
24
24
 
25
 
import breezy.bzr.bzrdir
 
25
import breezy.bzr
26
26
 
27
27
from . import lazy_import
28
28
lazy_import.lazy_import(globals(), """
40
40
    errors,
41
41
    globbing,
42
42
    hooks,
 
43
    lazy_regex,
43
44
    log,
44
45
    merge as _mod_merge,
45
46
    merge_directive,
1411
1412
 
1412
1413
    To retrieve the branch as of a particular revision, supply the --revision
1413
1414
    parameter, as in "branch foo/bar -r 5".
1414
 
 
1415
 
    The synonyms 'clone' and 'get' for this command are deprecated.
1416
1415
    """
1417
1416
 
1418
1417
    _see_also = ['checkout']
1440
1439
        Option('bind',
1441
1440
            help="Bind new branch to from location."),
1442
1441
        ]
1443
 
    aliases = ['get', 'clone']
1444
1442
 
1445
1443
    def run(self, from_location, to_location=None, revision=None,
1446
1444
            hardlink=False, stacked=False, standalone=False, no_tree=False,
1447
1445
            use_existing_dir=False, switch=False, bind=False,
1448
1446
            files_from=None):
1449
1447
        from breezy import switch as _mod_switch
1450
 
        if self.invoked_as in ['get', 'clone']:
1451
 
            ui.ui_factory.show_user_warning(
1452
 
                'deprecated_command',
1453
 
                deprecated_name=self.invoked_as,
1454
 
                recommended_name='branch',
1455
 
                deprecated_in_version='2.4')
1456
1448
        accelerator_tree, br_from = controldir.ControlDir.open_tree_or_branch(
1457
1449
            from_location)
1458
1450
        if not (hardlink or files_from):
2073
2065
                'See "help formats".',
2074
2066
                lazy_registry=('breezy.controldir', 'format_registry'),
2075
2067
                converter=lambda name: controldir.format_registry.make_controldir(name),
2076
 
                value_switches=True,
 
2068
                value_switches=False,
2077
2069
                title="Branch format",
2078
2070
                ),
2079
2071
         Option('append-revisions-only',
2152
2144
                url = repository.controldir.root_transport.external_url()
2153
2145
                try:
2154
2146
                    url = urlutils.local_path_from_url(url)
2155
 
                except errors.InvalidURL:
 
2147
                except urlutils.InvalidURL:
2156
2148
                    pass
2157
2149
                self.outf.write(gettext("Using shared repository: %s\n") % url)
2158
2150
 
2192
2184
                                 ' "brz help formats" for details.',
2193
2185
                            lazy_registry=('breezy.controldir', 'format_registry'),
2194
2186
                            converter=lambda name: controldir.format_registry.make_controldir(name),
2195
 
                            value_switches=True, title='Repository format'),
 
2187
                            value_switches=False, title='Repository format'),
2196
2188
                     Option('no-trees',
2197
2189
                             help='Branches in the repository will default to'
2198
2190
                                  ' not having a working tree.'),
3199
3191
                            'Invalid ignore patterns found. %s',
3200
3192
                            bad_patterns_count) % bad_patterns)
3201
3193
            ui.ui_factory.show_error(msg)
3202
 
            raise errors.InvalidPattern('')
 
3194
            raise lazy_regex.InvalidPattern('')
3203
3195
        for name_pattern in name_pattern_list:
3204
3196
            if (name_pattern[0] == '/' or
3205
3197
                (len(name_pattern) > 1 and name_pattern[1] == ':')):
3556
3548
                tag, bug_id = tokens
3557
3549
            try:
3558
3550
                yield bugtracker.get_bug_url(tag, branch, bug_id)
3559
 
            except errors.UnknownBugTrackerAbbreviation:
 
3551
            except bugtracker.UnknownBugTrackerAbbreviation:
3560
3552
                raise errors.BzrCommandError(gettext(
3561
3553
                    'Unrecognized bug %s. Commit refused.') % fixed_bug)
3562
 
            except errors.MalformedBugIdentifier as e:
 
3554
            except bugtracker.MalformedBugIdentifier as e:
3563
3555
                raise errors.BzrCommandError(gettext(
3564
3556
                    "%s\nCommit refused.") % (str(e),))
3565
3557
 
3872
3864
        # display a warning if an email address isn't included in the given name.
3873
3865
        try:
3874
3866
            _mod_config.extract_email_address(name)
3875
 
        except errors.NoEmailInUsername as e:
 
3867
        except _mod_config.NoEmailInUsername as e:
3876
3868
            warning('"%s" does not seem to contain an email address.  '
3877
3869
                    'This is allowed, but not recommended.', name)
3878
3870
 
4413
4405
                    raise errors.BzrCommandError(gettext(
4414
4406
                        'Cannot use -r with merge directives or bundles'))
4415
4407
                merger, verified = _mod_merge.Merger.from_mergeable(tree,
4416
 
                   mergeable, None)
 
4408
                   mergeable)
4417
4409
 
4418
4410
        if merger is None and uncommitted:
4419
4411
            if revision is not None and len(revision) > 0:
4568
4560
        # Merge tags (but don't set them in the master branch yet, the user
4569
4561
        # might revert this merge).  Commit will propagate them.
4570
4562
        other_branch.tags.merge_to(tree.branch.tags, ignore_master=True)
4571
 
        merger = _mod_merge.Merger.from_revision_ids(pb, tree,
 
4563
        merger = _mod_merge.Merger.from_revision_ids(tree,
4572
4564
            other_revision_id, base_revision_id, other_branch, base_branch)
4573
4565
        if other_path != '':
4574
4566
            allow_pending = False
4720
4712
        # have not yet been seen.
4721
4713
        tree.set_parent_ids(parents[:1])
4722
4714
        try:
4723
 
            merger = _mod_merge.Merger.from_revision_ids(None, tree, parents[1])
 
4715
            merger = _mod_merge.Merger.from_revision_ids(tree, parents[1])
4724
4716
            merger.interesting_ids = interesting_ids
4725
4717
            merger.merge_type = merge_type
4726
4718
            merger.show_base = show_base
5216
5208
            b.repository.start_write_group()
5217
5209
            try:
5218
5210
                for revision_id in revision_id_list:
 
5211
                    revision_id = cache_utf8.encode(revision_id)
5219
5212
                    b.repository.sign_revision(revision_id, gpg_strategy)
5220
5213
            except:
5221
5214
                b.repository.abort_write_group()