changeset 466:9548b406a2d8

pushmod: pass SubversionRepo directly to commit()
author Patrick Mezard <pmezard@gmail.com>
date Sat, 18 Jul 2009 20:44:33 -0500
parents d487bbe0e8af
children 3941d73c262e
files hgsubversion/pushmod.py hgsubversion/wrappers.py
diffstat 2 files changed, 4 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/pushmod.py
+++ b/hgsubversion/pushmod.py
@@ -92,12 +92,10 @@ def _externals(ctx):
     return ext
 
 
-def commit(ui, repo, rev_ctx, meta, svn_url, base_revision,
-           username, password):
+def commit(ui, repo, rev_ctx, meta, base_revision, svn):
     """Build and send a commit from Mercurial to Subversion.
     """
     file_data = {}
-    svn = svnwrap.SubversionRepo(svn_url, username, password)
     parent = rev_ctx.parents()[0]
     parent_branch = rev_ctx.parents()[0].branch()
     branch_path = 'trunk'
--- a/hgsubversion/wrappers.py
+++ b/hgsubversion/wrappers.py
@@ -112,11 +112,10 @@ def push(repo, dest, force, revs):
     assert not revs, 'designated revisions for push remains unimplemented.'
     cmdutil.bail_if_changed(repo)
     ui = repo.ui
-    svnurl = util.normalize_url(repo.ui.expandpath(dest.svnurl))
     old_encoding = util.swap_out_encoding()
-    # split of #rev; TODO: implement --rev/#rev support
-    svnurl, revs, checkout = hg.parseurl(svnurl, revs)
+    # TODO: implement --rev/#rev support
     # TODO: do credentials specified in the URL still work?
+    svnurl = repo.ui.expandpath(dest.svnurl)
     svn = svnrepo.svnremoterepo(repo.ui, svnurl).svn
     meta = repo.svnmeta(svn.uuid)
 
@@ -152,8 +151,7 @@ def push(repo, dest, force, revs):
         # 2. Commit oldest revision that needs to be pushed
         base_revision = hashes[base_n][0]
         try:
-            pushmod.commit(ui, repo, old_ctx, meta, svnurl,
-                           base_revision, svn.username, svn.password)
+            pushmod.commit(ui, repo, old_ctx, meta, base_revision, svn)
         except pushmod.NoFilesException:
             ui.warn("Could not push revision %s because it had no changes in svn.\n" %
                      old_ctx)