[py-svn] r36375 - in py/dist/py/path: . local svn
cfbolz at codespeak.net
cfbolz at codespeak.net
Tue Jan 9 17:18:36 CET 2007
Author: cfbolz
Date: Tue Jan 9 17:18:34 2007
New Revision: 36375
Modified:
py/dist/py/path/common.py
py/dist/py/path/local/local.py
py/dist/py/path/svn/svncommon.py
py/dist/py/path/svn/urlcommand.py
py/dist/py/path/svn/wccommand.py
Log:
clean up doc strings some more
Modified: py/dist/py/path/common.py
==============================================================================
--- py/dist/py/path/common.py (original)
+++ py/dist/py/path/common.py Tue Jan 9 17:18:34 2007
@@ -296,10 +296,12 @@
return self.new(basename='').join(*args, **kwargs)
def ext(self):
+ """ extension of the path (including the '.')."""
return self._getbyspec('ext')[0]
ext = property(ext, None, None, 'extension part of path')
def purebasename(self):
+ """ pure base name of the path."""
return self._getbyspec('purebasename')[0]
purebasename = property(purebasename, None, None, 'basename without extension')
@@ -368,6 +370,7 @@
return mod
def getpycodeobj(self):
+ """ read the path and compile it to a py.code.Code object. """
s = self.read('rU')
# XXX str(self) should show up somewhere in the code's filename
return py.code.compile(s)
Modified: py/dist/py/path/local/local.py
==============================================================================
--- py/dist/py/path/local/local.py (original)
+++ py/dist/py/path/local/local.py Tue Jan 9 17:18:34 2007
@@ -225,6 +225,7 @@
return self.stat().mtime
def copy(self, target, archive=False):
+ """ copy path to target."""
assert not archive, "XXX archive-mode not supported"
if self.check(file=1):
if target.check(dir=1):
@@ -420,6 +421,7 @@
return mod
def getpymodule(self):
+ """resolve this path to a module python object. """
if self.ext != '.c':
return super(LocalPath, self).getpymodule()
from py.__.misc.buildcmodule import make_module_from_c
@@ -427,6 +429,7 @@
return mod
def getpycodeobj(self):
+ """ read the path and compile it to a code object. """
dotpy = self.check(ext='.py')
if dotpy:
my_magic = py.std.imp.get_magic()
Modified: py/dist/py/path/svn/svncommon.py
==============================================================================
--- py/dist/py/path/svn/svncommon.py (original)
+++ py/dist/py/path/svn/svncommon.py Tue Jan 9 17:18:34 2007
@@ -151,12 +151,9 @@
content = self._proplist()
return content
- # XXX unify argument naming with LocalPath.listdir
def listdir(self, fil=None, sort=None):
- """ return a sequence of Paths.
-
- listdir will return either a tuple or a list of paths
- depending on implementation choices.
+ """ list directory contents, possibly filter by the given fil func
+ and possibly sorted.
"""
if isinstance(fil, str):
fil = common.fnmatch(fil)
Modified: py/dist/py/path/svn/urlcommand.py
==============================================================================
--- py/dist/py/path/svn/urlcommand.py (original)
+++ py/dist/py/path/svn/urlcommand.py Tue Jan 9 17:18:34 2007
@@ -105,7 +105,7 @@
return createpath
def copy(self, target, msg='copied by py lib invocation'):
- """ copy path to target with checkin msg msg."""
+ """ copy path to target with checkin message msg."""
if getattr(target, 'rev', None) is not None:
raise py.error.EINVAL(target, "revisions are immutable")
process.cmdexec('svn copy -m "%s" "%s" "%s"' %(msg,
Modified: py/dist/py/path/svn/wccommand.py
==============================================================================
--- py/dist/py/path/svn/wccommand.py (original)
+++ py/dist/py/path/svn/wccommand.py Tue Jan 9 17:18:34 2007
@@ -178,9 +178,11 @@
self._svn('remove', *flags)
def copy(self, target):
+ """ copy path to target."""
py.process.cmdexec("svn copy %s %s" %(str(self), str(target)))
def rename(self, target):
+ """ rename this path to target. """
py.process.cmdexec("svn move --force %s %s" %(str(self), str(target)))
rex_status = re.compile(r'\s+(\d+|-)\s+(\S+)\s+(\S+)\s+(.*)')
@@ -292,6 +294,9 @@
return rootstatus
def diff(self, rev=None):
+ """ return a diff of the current path against revision rev (defaulting
+ to the last one).
+ """
if rev is None:
out = self._svn('diff')
else:
@@ -299,6 +304,8 @@
return out
def blame(self):
+ """ return a list of tuples of three elements:
+(revision, commiter, line)"""
out = self._svn('blame')
result = []
blamelines = out.splitlines()
@@ -326,24 +333,30 @@
m = self.rex_commit.match(out)
return int(m.group(1))
- def propset(self, propname, value, *args):
+ def propset(self, name, value, *args):
+ """ set property name to value on this path. """
d = py.path.local.mkdtemp()
try:
p = d.join('value')
p.write(value)
- self._svn('propset', propname, '--file', str(p), *args)
+ self._svn('propset', name, '--file', str(p), *args)
finally:
d.remove()
def propget(self, name):
+ """ get property name on this path. """
res = self._svn('propget', name)
return res[:-1] # strip trailing newline
def propdel(self, name):
+ """ delete property name on this path. """
res = self._svn('propdel', name)
return res[:-1] # strip trailing newline
def proplist(self, rec=0):
+ """ return a mapping of property names to property values.
+If rec is True, then return a dictionary mapping sub-paths to such mappings.
+"""
if rec:
res = self._svn('proplist -R')
return make_recursive_propdict(self, res)
@@ -354,6 +367,8 @@
return svncommon.PropListDict(self, lines)
def revert(self, rec=0):
+ """ revert the local changes of this path. if rec is True, do so
+recursively. """
if rec:
result = self._svn('revert -R')
else:
@@ -361,6 +376,16 @@
return result
def new(self, **kw):
+ """ create a modified version of this path. A 'rev' argument
+ indicates a new revision.
+ the following keyword arguments modify various path parts:
+
+ http://host.com/repo/path/file.ext
+ |-----------------------| dirname
+ |------| basename
+ |--| purebasename
+ |--| ext
+ """
if kw:
localpath = self.localpath.new(**kw)
else:
@@ -453,6 +478,11 @@
return True
def log(self, rev_start=None, rev_end=1, verbose=False):
+ """ return a list of LogEntry instances for this path.
+rev_start is the starting revision (defaulting to the first one).
+rev_end is the last revision (defaulting to HEAD).
+if verbose is True, then the LogEntry instances also know which files changed.
+"""
from py.__.path.svn.urlcommand import _Head, LogEntry
assert self.check() # make it simpler for the pipe
rev_start = rev_start is None and _Head or rev_start
More information about the pytest-commit
mailing list