/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to upgrade.py

  • Committer: Jelmer Vernooij
  • Date: 2009-02-08 19:20:14 UTC
  • mto: (0.436.139 foreign)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20090208192014-0g17picqdx7edl92
Import foreign-mapping-upgrade command, fixes for bzr-svn.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
"""Upgrading revisions made with older versions of the mapping."""
17
17
 
18
 
from bzrlib import (
19
 
    trace,
20
 
    ui,
21
 
    )
 
18
from bzrlib import ui
22
19
from bzrlib.errors import (
23
20
    DependencyNotPresent,
24
21
    BzrError,
25
22
    InvalidRevisionId,
26
23
    NoSuchRevision,
27
24
    )
 
25
from bzrlib.trace import info
28
26
 
29
27
import itertools
30
28
 
147
145
 
148
146
 
149
147
def upgrade_tags(tags, repository, foreign_repository, new_mapping, 
150
 
                 allow_changes=False, verbose=False, branch_renames=None,
151
 
                 branch_ancestry=None):
 
148
                 allow_changes=False, verbose=False, branch_renames=None):
152
149
    """Upgrade a tags dictionary."""
153
150
    renames = {}
154
151
    if branch_renames is not None:
162
159
                renames.update(upgrade_repository(repository, foreign_repository, 
163
160
                      revision_id=revid, new_mapping=new_mapping,
164
161
                      allow_changes=allow_changes, verbose=verbose))
165
 
            if revid in renames and (branch_ancestry is None or not revid in branch_ancestry):
 
162
            if revid in renames:
166
163
                tags.set_tag(name, renames[revid])
167
164
    finally:
168
165
        pb.finished()
181
178
    renames = upgrade_repository(branch.repository, foreign_repository, 
182
179
              revision_id=revid, new_mapping=new_mapping,
183
180
              allow_changes=allow_changes, verbose=verbose)
 
181
    upgrade_tags(branch.tags, branch.repository, foreign_repository, 
 
182
           new_mapping=new_mapping, 
 
183
           allow_changes=allow_changes, verbose=verbose, branch_renames=renames)
184
184
    if revid in renames:
185
185
        branch.generate_revision_history(renames[revid])
186
 
    ancestry = branch.repository.get_ancestry(branch.last_revision(), topo_sorted=False)
187
 
    upgrade_tags(branch.tags, branch.repository, foreign_repository, 
188
 
           new_mapping=new_mapping, 
189
 
           allow_changes=allow_changes, verbose=verbose, branch_renames=renames,
190
 
           branch_ancestry=ancestry)
191
186
    return renames
192
187
 
193
188
 
327
322
                                                    allow_changes=allow_changes)
328
323
        if verbose:
329
324
            for revid in rebase_todo(repository, plan):
330
 
                trace.info("%s -> %s" % (revid, plan[revid][0]))
 
325
                info("%s -> %s" % (revid, plan[revid][0]))
331
326
        rebase(repository, plan, replay_snapshot)
332
327
        return revid_renames
333
328
    finally: