Commit 652c2f72 authored by bescoto's avatar bescoto

Making lines shorter... whee..


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@330 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 91dc5726
...@@ -71,8 +71,8 @@ def cmpfileobj(fp1, fp2): ...@@ -71,8 +71,8 @@ def cmpfileobj(fp1, fp2):
def check_for_files(*rps): def check_for_files(*rps):
"""Make sure that all the rps exist, raise error if not""" """Make sure that all the rps exist, raise error if not"""
for rp in rps: for rp in rps:
if not rp.lstat(): raise RPathException("File %s does not exist" if not rp.lstat():
% rp.get_indexpath()) raise RPathException("File %s does not exist" % rp.get_indexpath())
def move(rpin, rpout): def move(rpin, rpout):
"""Move rpin to rpout, renaming if possible""" """Move rpin to rpout, renaming if possible"""
...@@ -136,11 +136,9 @@ def cmp(rpin, rpout): ...@@ -136,11 +136,9 @@ def cmp(rpin, rpout):
elif rpin.issym(): elif rpin.issym():
return rpout.issym() and (rpin.readlink() == rpout.readlink()) return rpout.issym() and (rpin.readlink() == rpout.readlink())
elif rpin.ischardev(): elif rpin.ischardev():
return rpout.ischardev() and \ return rpout.ischardev() and (rpin.getdevnums() == rpout.getdevnums())
(rpin.getdevnums() == rpout.getdevnums())
elif rpin.isblkdev(): elif rpin.isblkdev():
return rpout.isblkdev() and \ return rpout.isblkdev() and (rpin.getdevnums() == rpout.getdevnums())
(rpin.getdevnums() == rpout.getdevnums())
elif rpin.isfifo(): return rpout.isfifo() elif rpin.isfifo(): return rpout.isfifo()
elif rpin.issock(): return rpout.issock() elif rpin.issock(): return rpout.issock()
else: raise RPathException("File %s has unknown type" % rpin.path) else: raise RPathException("File %s has unknown type" % rpin.path)
...@@ -152,8 +150,7 @@ def copy_attribs(rpin, rpout): ...@@ -152,8 +150,7 @@ def copy_attribs(rpin, rpout):
timestamps, so both must already exist. timestamps, so both must already exist.
""" """
log.Log("Copying attributes from %s to %s" % log.Log("Copying attributes from %s to %s" % (rpin.index, rpout.path), 7)
(rpin.index, rpout.path), 7)
check_for_files(rpin, rpout) check_for_files(rpin, rpout)
if rpin.issym(): return # symlinks have no valid attributes if rpin.issym(): return # symlinks have no valid attributes
if Globals.change_ownership: apply(rpout.chown, rpin.getuidgid()) if Globals.change_ownership: apply(rpout.chown, rpin.getuidgid())
...@@ -188,8 +185,7 @@ def copy_with_attribs(rpin, rpout, compress = 0): ...@@ -188,8 +185,7 @@ def copy_with_attribs(rpin, rpout, compress = 0):
def rename(rp_source, rp_dest): def rename(rp_source, rp_dest):
"""Rename rp_source to rp_dest""" """Rename rp_source to rp_dest"""
assert rp_source.conn is rp_dest.conn assert rp_source.conn is rp_dest.conn
log.Log(lambda: "Renaming %s to %s" % log.Log(lambda: "Renaming %s to %s" % (rp_source.path, rp_dest.path), 7)
(rp_source.path, rp_dest.path), 7)
if not rp_source.lstat(): rp_dest.delete() if not rp_source.lstat(): rp_dest.delete()
else: else:
if rp_dest.lstat() and rp_source.getinode() == rp_dest.getinode(): if rp_dest.lstat() and rp_source.getinode() == rp_dest.getinode():
...@@ -264,8 +260,7 @@ class RORPath: ...@@ -264,8 +260,7 @@ class RORPath:
for key in self.data.keys(): # compare dicts key by key for key in self.data.keys(): # compare dicts key by key
if (key == 'uid' or key == 'gid') and self.issym(): if (key == 'uid' or key == 'gid') and self.issym():
# Don't compare gid/uid for symlinks pass # Don't compare gid/uid for symlinks
pass
elif key == 'perms' and not Globals.change_permissions: pass elif key == 'perms' and not Globals.change_permissions: pass
elif key == 'atime' and not Globals.preserve_atime: pass elif key == 'atime' and not Globals.preserve_atime: pass
elif key == 'devloc' or key == 'nlink': pass elif key == 'devloc' or key == 'nlink': pass
...@@ -295,8 +290,7 @@ class RORPath: ...@@ -295,8 +290,7 @@ class RORPath:
pass pass
elif (key == 'type' and self.isspecial() and elif (key == 'type' and self.isspecial() and
other.isreg() and other.getsize() == 0): other.isreg() and other.getsize() == 0):
# Special files may be replaced with 0 len regular files pass # Special files may be replaced with empty regular files
pass
elif key == 'atime' and not Globals.preserve_atime: pass elif key == 'atime' and not Globals.preserve_atime: pass
elif key == 'devloc' or key == 'nlink': pass elif key == 'devloc' or key == 'nlink': pass
elif key == 'size' and not self.isreg(): pass elif key == 'size' and not self.isreg(): pass
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment