[PATCH 1 of 4] verify-cvs2svn: improve handling of extra/missing files in tree_compare():

Greg Ward <[email protected]>
Newsgroups gmane.comp.version-control.subversion.cvs2svn.devel
Message-ID <[email protected]>
- don't quit comparing trees just because of missing or extra entries
- report each missing/extra entry as a separate "anomaly"
- pro: we carry on and compare file contents for the files that do match
- con: extra/missing entries are reported twice

------------------------------------------------------
http://cvs2svn.tigris.org/ds/viewMessage.do?dsForumId=1667&dsMessageId=2384938

To unsubscribe from this discussion, e-mail: [[email protected]].
verify-relax-dir-compare.patch (text/x-patch, 1.6 KB)
# HG changeset patch
# User Greg Ward <[email protected]>
# Date 1249089034 14400
# Node ID 7f85d4a5b1bc2fb8f723d734790346f704849d90
# Parent  64336bc91981cc62ca0f45d515caf979bb836ab1
verify-cvs2svn: improve handling of extra/missing files in tree_compare():
- don't quit comparing trees just because of missing or extra entries
- report each missing/extra entry as a separate "anomaly"
- pro: we carry on and compare file contents for the files that do match
- con: extra/missing entries are reported twice

diff --git a/contrib/verify-cvs2svn.py b/contrib/verify-cvs2svn.py
--- a/contrib/verify-cvs2svn.py
+++ b/contrib/verify-cvs2svn.py
@@ -247,10 +247,16 @@
   else:
     path1 = os.path.join(base1, rel_path)
     path2 = os.path.join(base2, rel_path)
+  if not os.path.exists(path1):
+    print '*** ANOMALY: %s does not exist' % path1
+    return 0
+  if not os.path.exists(path2):
+    print '*** ANOMALY: %s does not exist' % path2
+    return 0
   if os.path.isfile(path1) and os.path.isfile(path2):
     return file_compare(base1, base2, run_diff, rel_path)
-  if not os.path.isdir(path1) or not os.path.isdir(path2):
-    print '*** ANOMALY: Path type differ for %s' % rel_path
+  if not (os.path.isdir(path1) and os.path.isdir(path2)):
+    print '*** ANOMALY: Path types differ for %r' % rel_path
     return 0
   entries1 = os.listdir(path1)
   entries1.sort()
@@ -264,8 +270,6 @@
   if extra:
     print '*** ANOMALY: Directory /%s has extra entries: %s' % (
       rel_path, ', '.join(extra))
-  if missing or extra:
-    return 0
   ok = 1
   for entry in entries1:
     new_rel_path = os.path.join(rel_path, entry)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.