Update of /cvsroot/cvs-syncmail/syncmail
In directory sc8-pr-cvs1:/tmp/cvs-serv4304
Modified Files:
syncmail
Log Message:
Fix stupid bug in revision 1.32: only refer to CVSEntry attributes
that actually exist.
Lots of changes working toword support for multi-directory commit
emails, but we hit a roadblock: CVS writes the needed meta-data to
only one directory at a time, not all of them.
Index: syncmail
===================================================================
RCS file: /cvsroot/cvs-syncmail/syncmail/syncmail,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- syncmail 9 Jul 2003 17:37:58 -0000 1.32
+++ syncmail 9 Jul 2003 20:38:34 -0000 1.33
@@ -287,35 +287,57 @@
self.options = options
self.tagdate = tagdate
-class CVSDirectory(CVSEntry):
- def __init__(self, name):
- CVSEntry.__init__(self, name, None, None, None, None, None)
+def get_entry(prefix, mapping, line, filename):
+ line = string.strip(line)
+ parts = string.split(line, "/")
+ _, name, revision, timestamp, options, tagdate = parts
+ key = namekey(prefix, name)
+ try:
+ entry = mapping[key]
+ except KeyError:
+ if revision == "0":
+ revision = None
+ if string.find(timestamp, "+") != -1:
+ timestamp, conflict = tuple(string.split(timestamp, "+"))
+ else:
+ conflict = None
+ entry = CVSEntry(key, revision, timestamp, conflict,
+ options, tagdate)
+ mapping[key] = entry
+ return entry
-def load_change_info():
- entries_fn = os.path.join("CVS", "Entries")
+def namekey(prefix, name):
+ if prefix:
+ return os.path.join(prefix, name)
+ else:
+ return name
+
+def load_change_info(prefix=None):
+ if prefix is not None:
+ entries_fn = os.path.join(prefix, "CVS", "Entries")
+ else:
+ entries_fn = os.path.join("CVS", "Entries")
entries_log_fn = entries_fn + ".Log"
- d = {}
+ mapping = {}
f = open(entries_fn)
while 1:
line = f.readline()
if not line:
break
- if string.strip(line) == "D":
- continue
- if line[0] == "D":
- name = string.split(line, "/")[1]
- d[name] = CVSDirectory(name)
- elif line[0] == "/":
+## if string.strip(line) == "D":
+## continue
+ # we could recurse down subdirs, except the Entries.Log files
+ # we need haven't been written to the subdirs yet, so it
+ # doesn't do us any good
+## if line[0] == "D":
+## name = string.split(line, "/")[1]
+## dirname = namekey(prefix, name)
+## if os.path.isdir(dirname):
+## m = load_change_info(dirname)
+## mapping.update(m)
+ if line[0] == "/":
# normal file
- parts = string.split(line, "/")
- _, name, revision, timestamp, options, tagdate = parts
- if revision == "0":
- revision = None
- conflict = None
- if string.find(timestamp, "+") != -1:
- timestamp, conflict = tuple(string.split(timestamp, "+"))
- d[name] = CVSEntry(name, revision, timestamp, conflict,
- options, tagdate)
+ get_entry(prefix, mapping, line, entries_fn)
# else: bogus Entries line
f.close()
if os.path.isfile(entries_log_fn):
@@ -327,25 +349,20 @@
if line[1:2] != ' ':
# really old version of CVS
break
+ entry = get_entry(prefix, mapping, line[2:], entries_log_fn)
parts = string.split(line, "/")[1:]
- name = parts[0]
if line[0] == "A":
# adding a file
- try:
- entry = d[name]
- except KeyError:
- entry = CVSEntry(name, None, parts[2], parts[3], parts[4])
- d[name] = entry
- d[name].new_revision = parts[1]
+ entry.new_revision = parts[1]
elif line[0] == "R":
# removing a file
- d[name].new_revision = None
+ entry.new_revision = None
f.close()
- for entry in d.values():
+ for entry in mapping.values():
if not hasattr(entry, "new_revision"):
- print 'confused about file', entry.file, '-- ignoring'
- del d[entry.name]
- return d
+ print 'confused about file', entry.name, '-- ignoring'
+ del mapping[entry.name]
+ return mapping
def load_branch_name():
tag_fn = os.path.join("CVS", "Tag")
|