Rev 519: Add -v option to svn-upgrade. in file:///data/jelmer/bzr-svn/0.4/

Jelmer Vernooij jelmer at samba.org
Thu Jul 12 09:28:39 BST 2007


At file:///data/jelmer/bzr-svn/0.4/

------------------------------------------------------------
revno: 519
revision-id: jelmer at samba.org-20070710133459-1gbetnemqb3pgvp1
parent: jelmer at samba.org-20070710032434-q4a4hkcymd1i0ox3
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Tue 2007-07-10 14:34:59 +0100
message:
  Add -v option to svn-upgrade.
modified:
  __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
  upgrade.py                     upgrade.py-20070106192108-0rakplee2lzah4gs-1
=== modified file '__init__.py'
--- a/__init__.py	2007-07-05 09:36:05 +0000
+++ b/__init__.py	2007-07-10 13:34:59 +0000
@@ -163,10 +163,10 @@
     were mapped from svn revisions.
     """
     takes_args = ['svn_repository?']
-    takes_options = []
+    takes_options = ['verbose']
 
     @display_command
-    def run(self, svn_repository=None):
+    def run(self, svn_repository=None, verbose=False):
         from upgrade import upgrade_branch
         from bzrlib.errors import NoWorkingTree
         from bzrlib.workingtree import WorkingTree
@@ -190,7 +190,8 @@
         else:
             svn_repository = Repository.open(svn_repository)
 
-        upgrade_branch(branch_to, svn_repository, allow_changes=True)
+        upgrade_branch(branch_to, svn_repository, allow_changes=True, 
+                       verbose=verbose)
 
         if wt_to is not None:
             wt_to.set_last_revision(branch_to.last_revision())

=== modified file 'upgrade.py'
--- a/upgrade.py	2007-07-05 10:32:29 +0000
+++ b/upgrade.py	2007-07-10 13:34:59 +0000
@@ -80,16 +80,17 @@
         return revid + suffix
 
 
-def upgrade_branch(branch, svn_repository, allow_changes=False):
+def upgrade_branch(branch, svn_repository, allow_changes=False, verbose=False):
     """Upgrade a branch to the current mapping version.
     
     :param branch: Branch to upgrade.
     :param svn_repository: Repository to fetch new revisions from
     :param allow_changes: Allow changes in mappings.
+    :param verbose: Whether to print verbose list of rewrites
     """
     revid = branch.last_revision()
     renames = upgrade_repository(branch.repository, svn_repository, 
-              revid, allow_changes)
+              revid, allow_changes=allow_changes, verbose=verbose)
     mutter('renames %r' % renames)
     if len(renames) > 0:
         branch.generate_revision_history(renames[revid])
@@ -108,14 +109,15 @@
 
 
 def upgrade_repository(repository, svn_repository, revision_id=None, 
-                       allow_change=False):
+                       allow_changes=False, verbose=False):
     """Upgrade the revisions in repository until the specified stop revision.
 
     :param repository: Repository in which to upgrade.
     :param svn_repository: Repository to fetch new revisions from.
     :param revision_id: Revision id up until which to upgrade, or None for 
                         all revisions.
-    :param allow_change: Allow changes to mappings.
+    :param allow_changes: Allow changes to mappings.
+    :param verbose: Whether to print list of rewrites
     :return: Dictionary of mapped revisions
     """
     try:
@@ -153,7 +155,7 @@
                         mutter("Remote repository doesn't have %r" % newrevid)
                     continue
                 rename_map[revid] = newrevid
-                if not allow_change:
+                if not allow_changes:
                     oldrev = repository.get_revision(revid)
                     newrev = svn_repository.get_revision(newrevid)
                     check_revision_changed(oldrev, newrev)
@@ -166,8 +168,10 @@
                 repository.fetch(svn_repository, revid)
 
         plan = generate_transpose_plan(repository, graph, rename_map, 
-                                       lambda rev: create_upgraded_revid(rev.revision_id))
-        mutter('rebase plan: %r' % plan)
+                           lambda rev: create_upgraded_revid(rev.revision_id))
+        if verbose:
+            for revid in rebase_todo(wt.branch.repository, replace_map):
+                info("%s -> %s" % (revid, replace_map[revid][0]))
         rebase(repository, plan, replay_snapshot)
         def remove_parents((oldrevid, (newrevid, parents))):
             return (oldrevid, newrevid)




More information about the bazaar-commits mailing list