/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
5557.1.7 by John Arbash Meinel
Merge in the bzr.dev 5582
1
# Copyright (C) 2005, 2006, 2008-2011 Canonical Ltd
1267 by Martin Pool
- notes on conversion of existing history to weaves
2
#
1080 by Martin Pool
- test tool for converting history to weave files
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.
1267 by Martin Pool
- notes on conversion of existing history to weaves
7
#
1080 by Martin Pool
- test tool for converting history to weave files
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.
1267 by Martin Pool
- notes on conversion of existing history to weaves
12
#
1080 by Martin Pool
- test tool for converting history to weave files
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
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1080 by Martin Pool
- test tool for converting history to weave files
16
6622.1.30 by Jelmer Vernooij
Some more test fixes.
17
"""brz upgrade logic."""
6379.6.7 by Jelmer Vernooij
Move importing from future until after doc string, otherwise the doc string will disappear.
18
6624 by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes')
19
from . import (
4360.10.40 by Vincent Ladeuil
Fix imports ;)
20
    errors,
4360.10.46 by Vincent Ladeuil
Get rid of _verbose_warning and rework the messages overall display (revealing some incoherences) and fixing the tests accordingly.
21
    trace,
4360.10.40 by Vincent Ladeuil
Fix imports ;)
22
    ui,
6072.3.1 by Jelmer Vernooij
Format URLs in ``bzr upgrade`` before display.
23
    urlutils,
4360.10.40 by Vincent Ladeuil
Fix imports ;)
24
    )
6624 by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes')
25
from .controldir import (
6207.3.3 by jelmer at samba
Fix tests and the like.
26
    ControlDir,
5582.10.8 by Jelmer Vernooij
More fixes.
27
    format_registry,
28
    )
6624 by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes')
29
from .i18n import gettext
6670.4.14 by Jelmer Vernooij
Move remote to breezy.bzr.
30
from .bzr.remote import RemoteBzrDir
1534.5.6 by Robert Collins
split out converter logic into per-format objects.
31
32
33
class Convert(object):
34
4360.10.1 by Ian Clatworthy
initial cut at smarter upgrades
35
    def __init__(self, url=None, format=None, control_dir=None):
36
        """Convert a Bazaar control directory to a given format.
37
38
        Either the url or control_dir parameter must be given.
39
40
        :param url: the URL of the control directory or None if the
41
          control_dir is explicitly given instead
42
        :param format: the format to convert to or None for the default
4360.10.10 by Ian Clatworthy
minor clean-ups
43
        :param control_dir: the control directory or None if it is
44
          specified via the URL parameter instead
4360.10.1 by Ian Clatworthy
initial cut at smarter upgrades
45
        """
1534.5.13 by Robert Collins
Correct buggy test.
46
        self.format = format
4634.144.9 by Martin Pool
Suppress user warnings about cross-format fetch during upgrade
47
        # XXX: Change to cleanup
48
        warning_id = 'cross_format_fetch'
4634.144.11 by Martin Pool
Rename squelched to suppressed
49
        saved_warning = warning_id in ui.ui_factory.suppressed_warnings
4360.10.1 by Ian Clatworthy
initial cut at smarter upgrades
50
        if url is None and control_dir is None:
51
            raise AssertionError(
52
                "either the url or control_dir parameter must be set.")
53
        if control_dir is not None:
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
54
            self.controldir = control_dir
4360.10.1 by Ian Clatworthy
initial cut at smarter upgrades
55
        else:
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
56
            self.controldir = ControlDir.open_unsupported(url)
57
        if isinstance(self.controldir, RemoteBzrDir):
58
            self.controldir._ensure_real()
59
            self.controldir = self.controldir._real_bzrdir
60
        if self.controldir.root_transport.is_readonly():
1534.5.7 by Robert Collins
Start factoring out the upgrade policy logic.
61
            raise errors.UpgradeReadonly
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
62
        self.transport = self.controldir.root_transport
4634.144.11 by Martin Pool
Rename squelched to suppressed
63
        ui.ui_factory.suppressed_warnings.add(warning_id)
1594.1.3 by Robert Collins
Fixup pb usage to use nested_progress_bar.
64
        try:
65
            self.convert()
66
        finally:
4634.144.9 by Martin Pool
Suppress user warnings about cross-format fetch during upgrade
67
            if not saved_warning:
4634.144.11 by Martin Pool
Rename squelched to suppressed
68
                ui.ui_factory.suppressed_warnings.remove(warning_id)
1534.5.6 by Robert Collins
split out converter logic into per-format objects.
69
70
    def convert(self):
1558.7.2 by Aaron Bentley
Upgrade works in repositories
71
        try:
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
72
            branch = self.controldir.open_branch()
73
            if branch.user_url != self.controldir.user_url:
6138.3.4 by Jonathan Riddell
add gettext() to uses of trace.note()
74
                ui.ui_factory.note(gettext(
4360.10.46 by Vincent Ladeuil
Get rid of _verbose_warning and rework the messages overall display (revealing some incoherences) and fixing the tests accordingly.
75
                    'This is a checkout. The branch (%s) needs to be upgraded'
6138.3.4 by Jonathan Riddell
add gettext() to uses of trace.note()
76
                    ' separately.') % (urlutils.unescape_for_display(
6072.3.2 by Jelmer Vernooij
Use utf8 as encoding for urls passed to note().
77
                        branch.user_url, 'utf-8')))
3602.2.1 by Martin Pool
Fix and test for problem upgrading stacked branches
78
            del branch
79
        except (errors.NotBranchError, errors.IncompatibleRepositories):
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
80
            # might not be a format we can open without upgrading; see e.g.
3602.2.1 by Martin Pool
Fix and test for problem upgrading stacked branches
81
            # https://bugs.launchpad.net/bzr/+bug/253891
1558.7.2 by Aaron Bentley
Upgrade works in repositories
82
            pass
4119.7.1 by Jelmer Vernooij
Make upgrade default to a rich-root-capable format if the source format uses rich roots.
83
        if self.format is None:
4170.3.5 by Jelmer Vernooij
Fix upgrade if there is no local repository present.
84
            try:
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
85
                rich_root = self.controldir.find_repository()._format.rich_root_data
4170.3.5 by Jelmer Vernooij
Fix upgrade if there is no local repository present.
86
            except errors.NoRepositoryPresent:
7143.15.2 by Jelmer Vernooij
Run autopep8.
87
                rich_root = False  # assume no rich roots
4170.3.5 by Jelmer Vernooij
Fix upgrade if there is no local repository present.
88
            if rich_root:
4119.7.1 by Jelmer Vernooij
Make upgrade default to a rich-root-capable format if the source format uses rich roots.
89
                format_name = "default-rich-root"
90
            else:
91
                format_name = "default"
6653.6.5 by Jelmer Vernooij
Rename make_bzrdir to make_controldir.
92
            format = format_registry.make_controldir(format_name)
4119.7.1 by Jelmer Vernooij
Make upgrade default to a rich-root-capable format if the source format uses rich roots.
93
        else:
94
            format = self.format
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
95
        if not self.controldir.needs_format_conversion(format):
96
            raise errors.UpToDateFormat(self.controldir._format)
97
        if not self.controldir.can_convert_format():
6138.3.4 by Jonathan Riddell
add gettext() to uses of trace.note()
98
            raise errors.BzrError(gettext("cannot upgrade from bzrdir format %s") %
7143.15.2 by Jelmer Vernooij
Run autopep8.
99
                                  self.controldir._format)
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
100
        self.controldir.check_conversion_target(format)
7143.15.2 by Jelmer Vernooij
Run autopep8.
101
        ui.ui_factory.note(gettext('starting upgrade of %s') %
102
                           urlutils.unescape_for_display(self.transport.base, 'utf-8'))
4471.2.2 by Martin Pool
Deprecate ProgressTask.note
103
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
104
        self.backup_oldpath, self.backup_newpath = self.controldir.backup_bzrdir()
105
        while self.controldir.needs_format_conversion(format):
106
            converter = self.controldir._format.get_converter(format)
107
            self.controldir = converter.convert(self.controldir, None)
6138.3.4 by Jonathan Riddell
add gettext() to uses of trace.note()
108
        ui.ui_factory.note(gettext('finished'))
1534.5.6 by Robert Collins
split out converter logic into per-format objects.
109
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
110
    def clean_up(self):
111
        """Clean-up after a conversion.
112
113
        This removes the backup.bzr directory.
114
        """
4360.10.12 by Ian Clatworthy
use transport.delete_tree() instead of osutils.rmtree() for clean-up
115
        transport = self.transport
116
        backup_relpath = transport.relpath(self.backup_newpath)
6861.4.1 by Jelmer Vernooij
Make progress bars context managers.
117
        with ui.ui_factory.nested_progress_bar() as child_pb:
118
            child_pb.update(gettext('Deleting backup.bzr'))
4360.10.27 by Matthew Fuller
Wrap a progress bar around removing the backup dir; it may take a
119
            transport.delete_tree(backup_relpath)
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
120
121
4360.10.30 by Matthew Fuller
The various repository formats that do packing, pack themselves as
122
def upgrade(url, format=None, clean_up=False, dry_run=False):
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
123
    """Upgrade locations to format.
7143.15.2 by Jelmer Vernooij
Run autopep8.
124
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
125
    This routine wraps the smart_upgrade() routine with a nicer UI.
126
    In particular, it ensures all URLs can be opened before starting
127
    and reports a summary at the end if more than one upgrade was attempted.
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
128
    This routine is useful for command line tools. Other breezy clients
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
129
    probably ought to use smart_upgrade() instead.
130
4360.10.28 by Matthew Fuller
Revert upgrade() to taking only a single URL. Other code attempting
131
    :param url: a URL of the locations to upgrade.
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
132
    :param format: the format to convert to or None for the best default
133
    :param clean-up: if True, the backup.bzr directory is removed if the
134
      upgrade succeeded for a given repo/branch/tree
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
135
    :param dry_run: show what would happen but don't actually do any upgrades
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
136
    :return: the list of exceptions encountered
137
    """
6207.3.3 by jelmer at samba
Fix tests and the like.
138
    control_dirs = [ControlDir.open_unsupported(url)]
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
139
    attempted, succeeded, exceptions = smart_upgrade(control_dirs,
7143.15.2 by Jelmer Vernooij
Run autopep8.
140
                                                     format, clean_up=clean_up, dry_run=dry_run)
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
141
    if len(attempted) > 1:
142
        attempted_count = len(attempted)
143
        succeeded_count = len(succeeded)
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
144
        failed_count = attempted_count - succeeded_count
4360.10.46 by Vincent Ladeuil
Get rid of _verbose_warning and rework the messages overall display (revealing some incoherences) and fixing the tests accordingly.
145
        ui.ui_factory.note(
7143.15.2 by Jelmer Vernooij
Run autopep8.
146
            gettext('\nSUMMARY: {0} upgrades attempted, {1} succeeded,'
6138.3.4 by Jonathan Riddell
add gettext() to uses of trace.note()
147
                    ' {2} failed').format(
7143.15.2 by Jelmer Vernooij
Run autopep8.
148
                attempted_count, succeeded_count, failed_count))
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
149
    return exceptions
150
151
4360.10.30 by Matthew Fuller
The various repository formats that do packing, pack themselves as
152
def smart_upgrade(control_dirs, format, clean_up=False,
7143.15.2 by Jelmer Vernooij
Run autopep8.
153
                  dry_run=False):
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
154
    """Convert control directories to a new format intelligently.
155
156
    If the control directory is a shared repository, dependent branches
157
    are also converted provided the repository converted successfully.
4360.10.1 by Ian Clatworthy
initial cut at smarter upgrades
158
    If the conversion of a branch fails, remaining branches are still tried.
159
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
160
    :param control_dirs: the BzrDirs to upgrade
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
161
    :param format: the format to convert to or None for the best default
4360.10.29 by Matthew Fuller
The param is clean_up, not clean-up.
162
    :param clean_up: if True, the backup.bzr directory is removed if the
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
163
      upgrade succeeded for a given repo/branch/tree
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
164
    :param dry_run: show what would happen but don't actually do any upgrades
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
165
    :return: attempted-control-dirs, succeeded-control-dirs, exceptions
4360.10.1 by Ian Clatworthy
initial cut at smarter upgrades
166
    """
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
167
    all_attempted = []
168
    all_succeeded = []
169
    all_exceptions = []
170
    for control_dir in control_dirs:
171
        attempted, succeeded, exceptions = _smart_upgrade_one(control_dir,
7143.15.2 by Jelmer Vernooij
Run autopep8.
172
                                                              format, clean_up=clean_up, dry_run=dry_run)
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
173
        all_attempted.extend(attempted)
174
        all_succeeded.extend(succeeded)
175
        all_exceptions.extend(exceptions)
176
    return all_attempted, all_succeeded, all_exceptions
177
178
4360.10.30 by Matthew Fuller
The various repository formats that do packing, pack themselves as
179
def _smart_upgrade_one(control_dir, format, clean_up=False,
7143.15.2 by Jelmer Vernooij
Run autopep8.
180
                       dry_run=False):
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
181
    """Convert a control directory to a new format intelligently.
182
4360.10.10 by Ian Clatworthy
minor clean-ups
183
    See smart_upgrade for parameter details.
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
184
    """
4360.10.11 by Ian Clatworthy
for a repo, just do dependent branches (not lw checkouts) for now
185
    # If the URL is a shared repository, find the dependent branches
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
186
    dependents = None
4360.10.1 by Ian Clatworthy
initial cut at smarter upgrades
187
    try:
188
        repo = control_dir.open_repository()
189
    except errors.NoRepositoryPresent:
190
        # A branch or checkout using a shared repository higher up
191
        pass
192
    else:
193
        # The URL is a repository. If it successfully upgrades,
4360.10.11 by Ian Clatworthy
for a repo, just do dependent branches (not lw checkouts) for now
194
        # then upgrade the dependent branches as well.
4360.10.1 by Ian Clatworthy
initial cut at smarter upgrades
195
        if repo.is_shared():
7358.5.3 by Jelmer Vernooij
Fix tests.
196
            dependents = list(repo.find_branches(using=True))
4360.10.1 by Ian Clatworthy
initial cut at smarter upgrades
197
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
198
    # Do the conversions
4360.10.1 by Ian Clatworthy
initial cut at smarter upgrades
199
    attempted = [control_dir]
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
200
    succeeded, exceptions = _convert_items([control_dir], format, clean_up,
4360.10.46 by Vincent Ladeuil
Get rid of _verbose_warning and rework the messages overall display (revealing some incoherences) and fixing the tests accordingly.
201
                                           dry_run)
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
202
    if succeeded and dependents:
6138.3.4 by Jonathan Riddell
add gettext() to uses of trace.note()
203
        ui.ui_factory.note(gettext('Found %d dependent branches - upgrading ...')
4360.10.46 by Vincent Ladeuil
Get rid of _verbose_warning and rework the messages overall display (revealing some incoherences) and fixing the tests accordingly.
204
                           % (len(dependents),))
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
205
        # Convert dependent branches
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
206
        branch_cdirs = [b.controldir for b in dependents]
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
207
        successes, problems = _convert_items(branch_cdirs, format, clean_up,
7143.15.2 by Jelmer Vernooij
Run autopep8.
208
                                             dry_run, label="branch")
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
209
        attempted.extend(branch_cdirs)
4360.10.3 by Ian Clatworthy
fix tests
210
        succeeded.extend(successes)
211
        exceptions.extend(problems)
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
212
213
    # Return the result
214
    return attempted, succeeded, exceptions
215
4360.10.49 by Vincent Ladeuil
Make _get_object_and_label() private to upgrade.py, its inmplementation is both incomplete and returning info that are not used.
216
# FIXME: There are several problems below:
217
# - RemoteRepository doesn't support _unsupported (really ?)
218
# - raising AssertionError is rude and may not be necessary
219
# - no tests
220
# - the only caller uses only the label
7143.15.2 by Jelmer Vernooij
Run autopep8.
221
222
4360.10.49 by Vincent Ladeuil
Make _get_object_and_label() private to upgrade.py, its inmplementation is both incomplete and returning info that are not used.
223
def _get_object_and_label(control_dir):
224
    """Return the primary object and type label for a control directory.
225
5891.1.2 by Andrew Bennetts
Fix a bunch of docstring formatting nits, making pydoctor a bit happier.
226
    :return: object, label where:
227
      * object is a Branch, Repository or WorkingTree and
228
      * label is one of:
229
        * branch            - a branch
230
        * repository        - a repository
231
        * tree              - a lightweight checkout
4360.10.49 by Vincent Ladeuil
Make _get_object_and_label() private to upgrade.py, its inmplementation is both incomplete and returning info that are not used.
232
    """
233
    try:
234
        try:
235
            br = control_dir.open_branch(unsupported=True,
236
                                         ignore_fallbacks=True)
237
        except NotImplementedError:
238
            # RemoteRepository doesn't support the unsupported parameter
239
            br = control_dir.open_branch(ignore_fallbacks=True)
240
    except errors.NotBranchError:
241
        pass
242
    else:
243
        return br, "branch"
244
    try:
245
        repo = control_dir.open_repository()
246
    except errors.NoRepositoryPresent:
247
        pass
248
    else:
249
        return repo, "repository"
250
    try:
251
        wt = control_dir.open_workingtree()
252
    except (errors.NoWorkingTree, errors.NotLocalUrl):
253
        pass
254
    else:
255
        return wt, "tree"
256
    raise AssertionError("unknown type of control directory %s", control_dir)
257
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
258
4360.10.46 by Vincent Ladeuil
Get rid of _verbose_warning and rework the messages overall display (revealing some incoherences) and fixing the tests accordingly.
259
def _convert_items(items, format, clean_up, dry_run, label=None):
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
260
    """Convert a sequence of control directories to the given format.
7143.15.2 by Jelmer Vernooij
Run autopep8.
261
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
262
    :param items: the control directories to upgrade
263
    :param format: the format to convert to or None for the best default
264
    :param clean-up: if True, the backup.bzr directory is removed if the
265
      upgrade succeeded for a given repo/branch/tree
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
266
    :param dry_run: show what would happen but don't actually do any upgrades
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
267
    :param label: the label for these items or None to calculate one
268
    :return: items successfully upgraded, exceptions
269
    """
270
    succeeded = []
271
    exceptions = []
6861.4.1 by Jelmer Vernooij
Make progress bars context managers.
272
    with ui.ui_factory.nested_progress_bar() as child_pb:
273
        child_pb.update(gettext('Upgrading bzrdirs'), 0, len(items))
274
        for i, control_dir in enumerate(items):
275
            # Do the conversion
276
            location = control_dir.root_transport.base
277
            bzr_object, bzr_label = _get_object_and_label(control_dir)
278
            type_label = label or bzr_label
7143.15.2 by Jelmer Vernooij
Run autopep8.
279
            child_pb.update(gettext("Upgrading %s") %
280
                            (type_label), i + 1, len(items))
281
            ui.ui_factory.note(gettext('Upgrading {0} {1} ...').format(type_label,
282
                                                                       urlutils.unescape_for_display(location, 'utf-8'),))
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
283
            try:
284
                if not dry_run:
6861.4.1 by Jelmer Vernooij
Make progress bars context managers.
285
                    cv = Convert(control_dir=control_dir, format=format)
286
            except errors.UpToDateFormat as ex:
287
                ui.ui_factory.note(str(ex))
288
                succeeded.append(control_dir)
289
                continue
6619.3.2 by Jelmer Vernooij
Apply 2to3 except fix.
290
            except Exception as ex:
6861.4.1 by Jelmer Vernooij
Make progress bars context managers.
291
                trace.warning('conversion error: %s' % ex)
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
292
                exceptions.append(ex)
6861.4.1 by Jelmer Vernooij
Make progress bars context managers.
293
                continue
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
294
6861.4.1 by Jelmer Vernooij
Make progress bars context managers.
295
            # Do any required post processing
296
            succeeded.append(control_dir)
297
            if clean_up:
298
                try:
299
                    ui.ui_factory.note(gettext('Removing backup ...'))
300
                    if not dry_run:
301
                        cv.clean_up()
302
                except Exception as ex:
7143.15.2 by Jelmer Vernooij
Run autopep8.
303
                    trace.warning(
304
                        gettext('failed to clean-up {0}: {1}') % (location, ex))
6861.4.1 by Jelmer Vernooij
Make progress bars context managers.
305
                    exceptions.append(ex)
4360.10.31 by Matthew Fuller
Wrap a progress bar around the iteration of entries to upgrade.
306
4360.10.4 by Ian Clatworthy
support multiple urls, --pack and --dry-run
307
    # Return the result
4360.10.2 by Ian Clatworthy
drop stacked vs unstacked logic; support multiple URLs
308
    return succeeded, exceptions