[Zope-CVS] CVS: CVSROOT - postcommit_actions:1.144

Ken Manheimer klm@zope.com
Thu, 19 Jun 2003 11:10:47 -0400


Update of /cvs-repository/CVSROOT
In directory cvs.zope.org:/tmp/cvs-serv23273

Modified Files:
	postcommit_actions 
Log Message:
Provide for special situation where initial checkin of a file is on a
branch.  In that case, the ,v file is in the Attic, and the diff
report looks at the ,v file, so needs to be pointed to the right
place.

This hasn't been heavily tested, so i'm going to watch the log file
for a bit.


=== CVSROOT/postcommit_actions 1.143 => 1.144 ===
--- CVSROOT/postcommit_actions:1.143	Mon Nov 25 16:14:30 2002
+++ CVSROOT/postcommit_actions	Thu Jun 19 11:10:17 2003
@@ -60,9 +60,9 @@
 
 # Ceiling on number of lines per file report (diff or "added"), at which point
 # we go to excerpts from the beginning and end:
-FILE_LINES_LIMIT = 500
+FILE_LINES_LIMIT = 1500
 # Number of lines in beginning and end excerpts when FILE_LINES_LIMIT is hit:
-FILE_EXCERPTS_LINES = 50
+FILE_EXCERPTS_LINES = 200
 
 CUSTOM_TRAFFIC_TABLE = "%s/custom_traffic_table.py" % CVSROOT
 
@@ -353,7 +353,24 @@
         header = ("=== %s/%s %s => %s ==="
                   % (str(repo), str(file), old, new))
 
-    if expands_as_binary(get_rcs_filename(repo, file)):
+    # Provide for initial checkins on branch - in which case, the ,v files
+    # exist only in the Attic.
+    if (old == 'NONE') and (len(new.split('.')) > 2):
+        template = "%s/%s/Attic/%s,v"
+    else:
+        template = "%s/%s/%s,v"
+    commav = template % (CVSROOT_ABS, repo, file)
+    if os.path.exists(commav):
+        isbinary = expands_as_binary(commav)
+    else:
+        complain("Couldn't check binary-ness of missing comma-v"
+                 " for %s%s v %s, should be at:\n  %s"
+                 % (((old == 'NONE') and "new ") or '',
+                    file, new, commav))
+        # Let the diff go ahead:
+        isbinary = None
+    
+    if isbinary:
         return "%s\n  <Binary-ish file>" % header
     else:
         total = len(lines)
@@ -369,14 +386,6 @@
             header = header + " (%s/%s lines abridged)" % (omitted, total)
         lines.insert(0, header + "\n")
         return string.join(lines, '')
-
-def get_rcs_filename(repodir, filename):
-    repofn = filename + ',v'
-    repodir = os.path.join(CVSROOT_ABS, repodir)
-    fn = os.path.join(repodir, repofn)
-    if not os.path.isfile(fn):
-        fn = os.path.join(repodir, "Attic", repofn)
-    return fn
 
 def do_special(trigger, action, addrs):
     """Do special action - a script, to be invoked from the CVSROOT dir.