parent
a1c7ab69f9
commit
a78ad64f9d
|
@ -93,6 +93,18 @@ class PathBase(object):
|
||||||
Checkers = Checkers
|
Checkers = Checkers
|
||||||
|
|
||||||
def check(self, **kw):
|
def check(self, **kw):
|
||||||
|
""" check a path for existence, or query its properties
|
||||||
|
|
||||||
|
without arguments, this returns True if the path exists (on the
|
||||||
|
filesystem), False if not
|
||||||
|
|
||||||
|
with (keyword only) arguments, the object compares the value
|
||||||
|
of the argument with the value of a property with the same name
|
||||||
|
(if it has one, else it raises a TypeError)
|
||||||
|
|
||||||
|
when for example the keyword argument 'ext' is '.py', this will
|
||||||
|
return True if self.ext == '.py', False otherwise
|
||||||
|
"""
|
||||||
if kw:
|
if kw:
|
||||||
kw = kw.copy()
|
kw = kw.copy()
|
||||||
if not checktype(self, kw):
|
if not checktype(self, kw):
|
||||||
|
@ -177,6 +189,18 @@ class PathBase(object):
|
||||||
return repr(str(self))
|
return repr(str(self))
|
||||||
|
|
||||||
def visit(self, fil=None, rec=None, ignore=_dummyclass):
|
def visit(self, fil=None, rec=None, ignore=_dummyclass):
|
||||||
|
""" yields all paths below the current one
|
||||||
|
|
||||||
|
fil is a filter (glob pattern or callable), if not matching the
|
||||||
|
path will not be yielded, defaulting to None (everything is
|
||||||
|
returned)
|
||||||
|
|
||||||
|
rec is a filter (glob pattern or callable) that controls whether
|
||||||
|
a node is descended, defaulting to None
|
||||||
|
|
||||||
|
ignore is an Exception class that is ignoredwhen calling dirlist()
|
||||||
|
on any of the paths (by default, all exceptions are reported)
|
||||||
|
"""
|
||||||
if isinstance(fil, str):
|
if isinstance(fil, str):
|
||||||
fil = fnmatch(fil)
|
fil = fnmatch(fil)
|
||||||
if rec:
|
if rec:
|
||||||
|
|
|
@ -55,6 +55,7 @@ class SvnWCCommandPath(common.FSPathBase):
|
||||||
return svncommon._escape_helper(cmd)
|
return svncommon._escape_helper(cmd)
|
||||||
|
|
||||||
def dump(self, obj):
|
def dump(self, obj):
|
||||||
|
""" pickle object into path location"""
|
||||||
return self.localpath.dump(obj)
|
return self.localpath.dump(obj)
|
||||||
|
|
||||||
def svnurl(self):
|
def svnurl(self):
|
||||||
|
@ -162,6 +163,10 @@ class SvnWCCommandPath(common.FSPathBase):
|
||||||
error_enhance(sys.exc_info())
|
error_enhance(sys.exc_info())
|
||||||
|
|
||||||
def mkdir(self, *args):
|
def mkdir(self, *args):
|
||||||
|
""" create & return the directory joined with args. """
|
||||||
|
p = self.join(*args)
|
||||||
|
self._callex(os.mkdir, str(p))
|
||||||
|
return p
|
||||||
if args:
|
if args:
|
||||||
return self.join(*args).mkdir()
|
return self.join(*args).mkdir()
|
||||||
else:
|
else:
|
||||||
|
@ -169,6 +174,7 @@ class SvnWCCommandPath(common.FSPathBase):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def add(self):
|
def add(self):
|
||||||
|
""" add ourself to svn """
|
||||||
self._svn('add')
|
self._svn('add')
|
||||||
|
|
||||||
def remove(self, rec=1, force=1):
|
def remove(self, rec=1, force=1):
|
||||||
|
|
Loading…
Reference in New Issue