[PATCH 4 of 4] verify-cvs2svn: compare file modes (to ensure executable bit is converted)

Greg Ward <[email protected]>
Newsgroups gmane.comp.version-control.subversion.cvs2svn.devel
Message-ID <[email protected]>
Patch subject is complete summary.

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

To unsubscribe from this discussion, e-mail: [[email protected]].
verify-compare-modes.patch (text/x-patch, 1.3 KB)
# HG changeset patch
# User Greg Ward <[email protected]>
# Date 1249091756 14400
# Node ID 6f3705641d602f840403e51728b40a0644ccfb01
# Parent  2216669960cbd028cd75d86c1a7a0a92f1b9af56
verify-cvs2svn: compare file modes (to ensure executable bit is converted)

diff --git a/contrib/verify-cvs2svn.py b/contrib/verify-cvs2svn.py
--- a/contrib/verify-cvs2svn.py
+++ b/contrib/verify-cvs2svn.py
@@ -252,11 +252,19 @@
 
 
 def file_compare(base1, base2, run_diff, rel_path):
-  """Compare the contents of two files.  The paths are specified as two
-  base paths BASE1 and BASE2, and a path REL_PATH that is relative to the
-  two base paths.  Return 1 if the file contetns are identical, else 0."""
+  """Compare the mode and contents of two files.  The paths are
+  specified as two base paths BASE1 and BASE2, and a path REL_PATH that
+  is relative to the two base paths.  Return 1 if the file mode and
+  contents are identical, else 0."""
   path1 = os.path.join(base1, rel_path)
   path2 = os.path.join(base2, rel_path)
+  mode1 = os.stat(path1).st_mode & 0700   # only look at owner bits
+  mode2 = os.stat(path2).st_mode & 0700
+  if mode1 != mode2:
+    print '*** ANOMALY: File modes differ for %s' % rel_path
+    print '***   %s: %o' % (path1, mode1)
+    print '***   %s: %o' % (path2, mode2)
+
   file1 = open(path1, 'rb')
   file2 = open(path2, 'rb')
   while 1:
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.