author |
<albertogli@telpin.com.ar> 2005-03-02 17:28:06 UTC |
committer |
<albertogli@telpin.com.ar> 2005-03-02 17:28:06 UTC |
parent | 62ac1bbc2af8ddeb4a0f8240ce55d95390f869a7 |
abk | +17 | -10 |
diff --git a/abk b/abk index 49f9c11..d568ba3 100644 --- a/abk +++ b/abk @@ -73,23 +73,32 @@ class file_info: if self.type == 'r': self.hash = self.hash_file() - def __eq__(self, other): - "Compares to other file_info object." - if self.name != other.name: return 0 + def cmp_mdata(self, other): + "Compares metadata to other." if self.mtime != other.mtime: return 0 - if self.type != other.type: return 0 - if self.size != other.size: return 0 if self.mode != other.mode: return 0 if self.uid != other.uid: return 0 if self.gid != other.gid: return 0 - if self.hash != other.hash: return 0 + return 1 - if self.mode == 'b' or self.mode == 'c': + def cmp_data(self, other): + "Compares data to other." + if self.size != other.size: return 0 + if self.hash != other.hash: return 0 + if self.type != other.type: return 0 + if self.type == 'b' or self.type == 'c': if self.rdev != other.rdev: return 0 - if self.mode == 'l': + if self.type == 'l': if self.linkto != other.linkto: return 0 + return 1 + + def __eq__(self, other): + "Compares to other file_info object." + if self.name != other.name: return 0 + if not self.cmp_data(other): return 0 + if not self.cmp_mdata(other): return 0 return 1 @@ -138,7 +147,6 @@ class file_info: dev = os.makedev(major, minor) os.mknod(dst, self.mode, dev) - def update_mdata(self, dst): "Updates a file's metadata." os.lchown(dst, self.uid, self.gid) @@ -147,7 +155,6 @@ class file_info: os.utime(dst, (self.atime, self.mtime)) os.chmod(dst, self.mode & 07777) - def copy_file(self, dst): "Copies a file, along with its permissions and ownership." if self.type == 'r':