a code review (eric.gillespie/path-style)

3 views
Skip to first unread message

e...@google.com

unread,
May 11, 2007, 3:44:01 PM5/11/07
to gvn-d...@googlegroups.com
I'd like you to do a code review. To review this change please execute:

gvn review --project https://gvn.googlecode.com/svn eric.gillespie/path-style@6

Alternatively, to review the latest checkpoint of this change
branch please execute:

gvn --project https://gvn.googlecode.com/svn review eric.gillespie/path-style

to review the following code:

*eric.gillespie/path-style@6 | eric.gillespie | 2007-05-11 11:40:46 -0800 (Fri, 11 May 2007)

Description:

* lib/gvn/cmdline.py
* lib/gvn/subcommands/change.py
* lib/gvn/wc_test.py
* testing/repository.py
* testing/testcommon.py
Use svn_path_internal_style instead of gvn.platform.UnixPath .

* lib/gvn/platform.py
* lib/gvn/platform_test.py
Drop UnixPath.

Affected Paths:
M //trunk/lib/gvn/cmdline.py
M //trunk/lib/gvn/platform.py
M //trunk/lib/gvn/platform_test.py
M //trunk/lib/gvn/subcommands/change.py
M //trunk/lib/gvn/wc_test.py
M //trunk/testing/repository.py
M //trunk/testing/testcommon.py


This is a semiautomated message from "gvn mail". See
<http://code.google.com/p/gvn/> to learn more.

Index: lib/gvn/cmdline.py
===================================================================
--- lib/gvn/cmdline.py (//trunk/lib/gvn/cmdline.py@5)
+++ lib/gvn/cmdline.py (//changes/eric.gillespie/path-style/trunk/lib/gvn/cmdline.py@6)
@@ -59,6 +59,8 @@
import svn.core
import svn.wc

+from svn.core import svn_path_internal_style
+
import gvn.config
import gvn.errors
import gvn.platform
@@ -380,7 +382,7 @@

def OpenWorkingCopy(self, write_lock=False):
(self._wc,
- self.path) = gvn.wc.FindWorkingCopy(gvn.platform.UnixPath(os.getcwd()),
+ self.path) = gvn.wc.FindWorkingCopy(svn_path_internal_style(os.getcwd()),
cancel_func=self.Cancel,
notify_func=self.Notify,
config=self.config,
Index: lib/gvn/platform.py
===================================================================
--- lib/gvn/platform.py (//trunk/lib/gvn/platform.py@5)
+++ lib/gvn/platform.py (//changes/eric.gillespie/path-style/trunk/lib/gvn/platform.py@6)
@@ -25,23 +25,5 @@
from gvn.posix import *


-# TODO(epg): Replace with svn_path_internal_style.
-def UnixPath(full_path):
- """Convert a Windows path to its Unix analogue and return the result.
-
- Arguments:
- full_path -- The absolute or relative path to be converted.
-
- Returns:
- On Windows, the pathname with all \ replaced with /.
- Otherwise, the unchanged pathname.
-
- """
-
- if sys.platform == 'win32':
- return full_path.replace('\\', '/')
- return full_path
-
-
Properties:
svn:eol-style: native
Index: lib/gvn/platform_test.py
===================================================================
--- lib/gvn/platform_test.py (//trunk/lib/gvn/platform_test.py@5)
+++ lib/gvn/platform_test.py (//changes/eric.gillespie/path-style/trunk/lib/gvn/platform_test.py@6)
@@ -24,17 +24,6 @@

class TestGvnPlatform(unittest.TestCase):

- def testUnixPath(self):
- if sys.platform == 'win32':
- self.assertEquals(platform.UnixPath('a\\b'), 'a/b')
- self.assertEquals(platform.UnixPath('\\a\\b\\c'), '/a/b/c')
- self.assertEquals(platform.UnixPath('C:\\a\\b\\c'), 'C:/a/b/c')
- else:
- self.assertEquals(platform.UnixPath('a\\b'), 'a\\b')
- self.assertEquals(platform.UnixPath('\\a\\b\\c'), '\\a\\b\\c')
- self.assertEquals(platform.UnixPath('C:\\a\\b\\c'), 'C:\\a\\b\\c')
- self.assertEquals(platform.UnixPath('/home/foo/abc'), '/home/foo/abc')
-
def testDescribeSubprocessError(self):
describe = platform.DescribeSubprocessError
if sys.platform == 'win32':
Index: lib/gvn/subcommands/change.py
===================================================================
--- lib/gvn/subcommands/change.py (//trunk/lib/gvn/subcommands/change.py@5)
+++ lib/gvn/subcommands/change.py (//changes/eric.gillespie/path-style/trunk/lib/gvn/subcommands/change.py@6)
@@ -16,6 +16,8 @@
import os
import posixpath

+from svn.core import svn_path_internal_style
+
import gvn.changebranch
import gvn.cmdline
import gvn.errors
@@ -229,7 +231,7 @@
targets = [ctx.path]

# Convert local paths from the command line to internal style.
- targets = [gvn.platform.UnixPath(x) for x in targets]
+ targets = [svn_path_internal_style(x, ctx.pool) for x in targets]

# Remove all paths in changed_paths starting with any path in targets
# (e.g. targets=['foo'] changed_paths=['food', 'foo', 'foo/bar'],
Index: lib/gvn/wc_test.py
===================================================================
--- lib/gvn/wc_test.py (//trunk/lib/gvn/wc_test.py@5)
+++ lib/gvn/wc_test.py (//changes/eric.gillespie/path-style/trunk/lib/gvn/wc_test.py@6)
@@ -21,6 +21,7 @@

from svn.core import SWIG_SVN_INVALID_REVNUM as SVN_INVALID_REVNUM
from svn.core import svn_node_dir, svn_node_file
+from svn.core import svn_path_internal_style

import gvn.wc

@@ -248,8 +249,9 @@
def testBasic(self):
# TODO(epg): Test prop change, _Added, and _Replaced.
pool = svn.core.Pool()
- (wc, subpath) = gvn.wc.FindWorkingCopy(gvn.platform.UnixPath(os.getcwd()),
- cancel_func=None, notify_func=None,
+ (wc, subpath) = gvn.wc.FindWorkingCopy(svn_path_internal_style(os.getcwd(),
+ pool),
+ cancel_func=None, notify_func=None,
config=self.config, write_lock=True,
pool=pool)
testcommon.GetAuthBaton(self.config, pool, wc.project.repository)
@@ -326,7 +328,8 @@

def testRecursiveAdd(self):
pool = svn.core.Pool()
- (wc, subpath) = gvn.wc.FindWorkingCopy(gvn.platform.UnixPath(os.getcwd()),
+ (wc, subpath) = gvn.wc.FindWorkingCopy(svn_path_internal_style(os.getcwd(),
+ pool),
cancel_func=None, notify_func=None,
config=self.config, write_lock=True,
pool=pool)
@@ -381,7 +384,8 @@

def testRecursiveRemove(self):
pool = svn.core.Pool()
- (wc, subpath) = gvn.wc.FindWorkingCopy(gvn.platform.UnixPath(os.getcwd()),
+ (wc, subpath) = gvn.wc.FindWorkingCopy(svn_path_internal_style(os.getcwd(),
+ pool),
cancel_func=None, notify_func=None,
config=self.config, write_lock=True,
pool=pool)
Index: testing/repository.py
===================================================================
--- testing/repository.py (//trunk/testing/repository.py@5)
+++ testing/repository.py (//changes/eric.gillespie/path-style/trunk/testing/repository.py@6)
@@ -20,7 +20,7 @@
from gvn import platform
from gvn import svncmd

-from svn.core import SubversionException
+from svn.core import SubversionException, svn_path_internal_style


def CreateEmptyRepository(dir):
@@ -106,7 +106,7 @@
f.close()
tmp_pool.destroy()

- return platform.UnixPath(repo_dir)
+ return svn_path_internal_style(repo_dir)


Properties:
Index: testing/testcommon.py
===================================================================
--- testing/testcommon.py (//trunk/testing/testcommon.py@5)
+++ testing/testcommon.py (//changes/eric.gillespie/path-style/trunk/testing/testcommon.py@6)
@@ -25,6 +25,7 @@

import svn.wc
from svn.core import SVN_AUTH_PARAM_DEFAULT_PASSWORD, svn_auth_set_parameter
+from svn.core import svn_path_internal_style

import testing.httpd

@@ -170,7 +171,7 @@
print >>sys.stderr, stderr
return None

- return platform.UnixPath(wcdir)
+ return svn_path_internal_style(wcdir)


def TestSetUp(dir):

Erik Kline

unread,
May 11, 2007, 3:55:03 PM5/11/07
to gvn-d...@googlegroups.com
LGTM

We need to see if we can turn off the commit mails for //changes/...

Reply all
Reply to author
Forward
0 new messages