Update of /cvsroot/cvs-syncmail/syncmail
In directory sc8-pr-cvs1:/tmp/cvs-serv29435
Modified Files:
Tag: new-config-branch
syncmail
Log Message:
Use rcsdiff instead of cvs diff to generate diffs.
Index: syncmail
===================================================================
RCS file: /cvsroot/cvs-syncmail/syncmail/syncmail,v
retrieving revision 1.36.2.10
retrieving revision 1.36.2.11
diff -u -d -r1.36.2.10 -r1.36.2.11
--- syncmail 10 Jul 2003 22:03:05 -0000 1.36.2.10
+++ syncmail 10 Jul 2003 22:15:00 -0000 1.36.2.11
@@ -173,25 +173,14 @@
if oldrev is None and newrev is None:
return NOVERSION % file
- if "'" in file:
- # Those crazy users put single-quotes in their file names! Now we
- # have to escape everything that is meaningful inside double-quotes.
- filestr = string.replace(file, '\\', '\\\\')
- filestr = string.replace(filestr, '`', '\`')
- filestr = string.replace(filestr, '"', '\"')
- filestr = string.replace(filestr, '$', '\$')
- # and quote it with double-quotes.
- filestr = '"' + filestr + '"'
- else:
- # quote it with single-quotes.
- filestr = "'" + file + "'"
if oldrev is None:
# File is being added.
try:
if os.path.exists(file):
fp = open(file)
else:
- update_cmd = "cvs -fn update -r %s -p %s" % (newrev, filestr)
+ update_cmd = ("cvs -fn update -r %s -p %s"
+ % (newrev, filestr(file)))
fp = os.popen(update_cmd)
lines = fp.readlines()
fp.close()
@@ -218,8 +207,9 @@
difftype = "-C %d" % config.contextlines
else:
difftype = "-u"
- diffcmd = "/usr/bin/cvs -f diff -kk %s --minimal -r %s -r %s %s" \
- % (difftype, oldrev, newrev, filestr)
+ rcsfile = get_rcs_file(config, file)
+ diffcmd = "/usr/bin/rcsdiff -kk %s --minimal -r %s -r %s %s" \
+ % (difftype, oldrev, newrev, filestr(rcsfile))
fp = os.popen(diffcmd)
lines = fp.readlines()
# ignore the error code, it always seems to be 1 :(
@@ -231,6 +221,26 @@
'[...%d lines suppressed...]\n' % removedlines)
return string.join(lines, '')
+def filestr(file):
+ if "'" in file:
+ # Those crazy users put single-quotes in their file names! Now we
+ # have to escape everything that is meaningful inside double-quotes.
+ filestr = string.replace(file, '\\', '\\\\')
+ filestr = string.replace(filestr, '`', '\`')
+ filestr = string.replace(filestr, '"', '\"')
+ filestr = string.replace(filestr, '$', '\$')
+ # and quote it with double-quotes.
+ return '"%s"' % filestr
+ else:
+ # quote it with single-quotes.
+ return "'%s'" % file
+
+def get_rcs_file(config, file):
+ fn = os.path.join(config.repodir, file)
+ if not os.path.isfile(fn):
+ fn = os.path.join(config.repodir, "Attic", file)
+ return fn
+
rfc822_specials_re = re.compile(r'[\(\)\<\>\@\,\;\:\\\"\.\[\]]')
@@ -592,6 +602,7 @@
self.people = string.join(args[1:], COMMASPACE)
else:
self.people = config.get("to")
+ self.repodir = os.curdir
def load_configuration(args, branch=None):
cmdline, args = load_cmdline(args)
@@ -611,6 +622,8 @@
def main():
# load the options
config = load_configuration(sys.argv[1:], load_branch_name())
+ s = open(os.path.join("CVS", "Repository")).readline()
+ config.repodir = string.strip(s)
# args[0] is the specification containing the files that were
# modified. The argument actually must be split, with the first component
|