# HG changeset patch # User Augie Fackler # Date 1222956788 18000 # Node ID 1a5bb173170b266dd01c15d7e8c285b9856c0664 # Parent 0548662e2f34c4713c5b8bb1e3c216178b73dffb Fixes for win32 compatibility. Changes suggested by Shun-ichi GOTO, with some alterations by me. diff --git a/fetch_command.py b/fetch_command.py --- a/fetch_command.py +++ b/fetch_command.py @@ -3,13 +3,13 @@ import re import operator import os import shutil -import stat import tempfile from mercurial import patch from mercurial import node from mercurial import context from mercurial import revlog +from mercurial import util as merc_util from svn import core from svn import delta @@ -40,7 +40,7 @@ def fetch_revisions(ui, svn_url, hg_repo ' of SWIG.') have_replay = False initializing_repo = False - svn = svnwrap.SubversionRepo(svn_url) + svn = svnwrap.SubversionRepo(svn_url, username=merc_util.getuser()) author_host = "@%s" % svn.uuid tag_locations = tag_locations.split(',') hg_editor = hg_delta_editor.HgChangeReceiver(hg_repo_path, diff --git a/hg_delta_editor.py b/hg_delta_editor.py --- a/hg_delta_editor.py +++ b/hg_delta_editor.py @@ -8,6 +8,7 @@ import traceback from mercurial import context from mercurial import hg from mercurial import ui +from mercurial import util from mercurial import revlog from mercurial import node from svn import delta @@ -27,7 +28,7 @@ def pickle_atomic(data, file_path, dir=N except: raise else: - os.rename(path, file_path) + util.rename(path, file_path) def stash_exception_on_self(fn): """Stash any exception raised in the method on self. diff --git a/push_cmd.py b/push_cmd.py --- a/push_cmd.py +++ b/push_cmd.py @@ -94,7 +94,7 @@ def commit_from_rev(ui, repo, rev_ctx, h file_data[file] = base_data, new_data, action # TODO check for directory deletes here - svn = svnwrap.SubversionRepo(svn_url) + svn = svnwrap.SubversionRepo(svn_url, username=merc_util.getuser()) parent_branch = rev_ctx.parents()[0].branch() branch_path = 'trunk' if parent_branch and parent_branch != 'default': diff --git a/svncommand.py b/svncommand.py --- a/svncommand.py +++ b/svncommand.py @@ -4,6 +4,7 @@ import stat from mercurial import hg from mercurial import node +from mercurial import util as merc_util import svnwrap import hg_delta_editor @@ -101,7 +102,7 @@ def verify_revision(ui, args, repo, forc rev = int(args[0]) wc_path = os.path.dirname(repo.path) svn_url = open(os.path.join(repo.path, 'svn', 'url')).read() - svn = svnwrap.SubversionRepo(svn_url) + svn = svnwrap.SubversionRepo(svn_url, username=merc_util.getuser()) util.wipe_all_files(wc_path) if update(ui, args, repo, clean=True) == 0: util.wipe_all_files(wc_path) diff --git a/svnwrap/svn_swig_wrapper.py b/svnwrap/svn_swig_wrapper.py --- a/svnwrap/svn_swig_wrapper.py +++ b/svnwrap/svn_swig_wrapper.py @@ -1,7 +1,6 @@ import cStringIO import getpass import os -import pwd import shutil import sys import tempfile @@ -69,8 +68,9 @@ class SubversionRepo(object): This uses the SWIG Python bindings, and will only work on svn >= 1.4. It takes a required param, the URL. """ - def __init__(self, url=''): + def __init__(self, url='', username=''): self.svn_url = url + self.uname = username self.auth_baton_pool = core.Pool() self.auth_baton = _create_auth_baton(self.auth_baton_pool) @@ -89,7 +89,6 @@ class SubversionRepo(object): # while we're in here we'll recreate our pool self.pool = core.Pool() self.client_context = client.create_context() - self.uname = str(pwd.getpwuid(os.getuid())[0]) core.svn_auth_set_parameter(self.auth_baton, core.SVN_AUTH_PARAM_DEFAULT_USERNAME, self.uname)