diff options
author | Guido van Rossum <guido@python.org> | 1995-05-01 20:06:06 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-05-01 20:06:06 (GMT) |
commit | 1c653bd6bec43aaa7ee71e139e1c601b0872c718 (patch) | |
tree | 652dd3158dd8ad4b2f7d1a047743f3bdcfe38465 /Demo/pdist | |
parent | 6c1504629f6eedbf5df330cbd745091543d4cb2d (diff) | |
download | cpython-1c653bd6bec43aaa7ee71e139e1c601b0872c718.zip cpython-1c653bd6bec43aaa7ee71e139e1c601b0872c718.tar.gz cpython-1c653bd6bec43aaa7ee71e139e1c601b0872c718.tar.bz2 |
moved proxy; added __cmp__(); made proxy optional for getremote()
Diffstat (limited to 'Demo/pdist')
-rwxr-xr-x | Demo/pdist/cvslib.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Demo/pdist/cvslib.py b/Demo/pdist/cvslib.py index 390b31e..3e7db14 100755 --- a/Demo/pdist/cvslib.py +++ b/Demo/pdist/cvslib.py @@ -19,6 +19,7 @@ class File: (this implies that the entry must be written back) sseen -- true if the data from the CVS/Sums file is up to date rseen -- true if the data for the remote file is up to date + proxy -- RCSProxy instance used to contact the server, or None Note that lseen and rseen don't necessary mean that a local or remote file *exists* -- they indicate that we've checked it. @@ -41,7 +42,6 @@ class File: If rseen is true: - proxy -- RCSProxy instance used to contact the server rrev -- revision of head, None if non-existent rsum -- checksum of that revision, Non if non-existent @@ -57,16 +57,18 @@ class File: raise ValueError, "no slash allowed in file" self.file = file self.lseen = self.eseen = self.rseen = 0 + self.proxy = None + + def __cmp__(self, other): + return cmp(self.file, other.file) def getlocal(self): try: self.lmtime, self.lctime = os.stat(self.file)[-2:] except os.error: - self.lmtime = self.lctime = None - if self.lmtime: - self.lsum = md5.new(open(self.file).read()).digest() + self.lmtime = self.lctime = self.lsum = None else: - self.lsum = None + self.lsum = md5.md5(open(self.file).read()).digest() self.lseen = 1 def getentry(self, line): @@ -93,8 +95,9 @@ class File: self.getesum() self.eseen = 1 - def getremote(self, proxy): - self.proxy = proxy + def getremote(self, proxy = None): + if proxy: + self.proxy = proxy try: self.rrev = self.proxy.head(self.file) except (os.error, IOError): |