You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2010/08/31 17:47:19 UTC

svn commit: r991223 - /subversion/trunk/tools/dev/wc-ng/bump-to-19.py

Author: julianfoad
Date: Tue Aug 31 15:47:19 2010
New Revision: 991223

URL: http://svn.apache.org/viewvc?rev=991223&view=rev
Log:
In bump-to-19.py, don't fail on missing pristine dir, as that's a legitimate
state if there are no versioned files that have bases in this WC dir.  Also
make sure to delete the pristine dir; previously it was only deleted if any
files had been moved from it.

* tools/dev/wc-ng/bump-to-19.py
  (move_and_shard_pristine_files): If there is no 'pristine' dir, just
    return successfully.
  (shard_pristine_files): Remove, as we can use move_and_shard_pristine_files()
    instead.
  (migrate_wc_subdirs): Remove the old pristine dir if it still exists.
  (__main__): Use move_and_shard_pristine_files() instead of
    shard_pristine_files(), for simplicity.

Modified:
    subversion/trunk/tools/dev/wc-ng/bump-to-19.py

Modified: subversion/trunk/tools/dev/wc-ng/bump-to-19.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dev/wc-ng/bump-to-19.py?rev=991223&r1=991222&r2=991223&view=diff
==============================================================================
--- subversion/trunk/tools/dev/wc-ng/bump-to-19.py (original)
+++ subversion/trunk/tools/dev/wc-ng/bump-to-19.py Tue Aug 31 15:47:19 2010
@@ -171,20 +171,6 @@ def copy_db_rows_to_wcroot(wc_subdir_rel
   db.close()
 
 
-def shard_pristine_files(wc_path):
-  """Move all pristine text files from 'WC_PATH/.svn/pristine/'
-     into shard directories: 'WC_PATH/.svn/pristine/??/', creating those
-     shard dirs where necessary."""
-
-  pristine_dir = pristine_path(wc_path)
-
-  for basename in os.listdir(pristine_dir):
-    shard = basename[:2]
-    old = os.path.join(pristine_dir, basename)
-    new = os.path.join(pristine_dir, shard, basename)
-    os.renames(old, new)
-
-
 def move_and_shard_pristine_files(old_wc_path, new_wc_path):
   """Move all pristine text files from 'OLD_WC_PATH/.svn/pristine/'
      into 'NEW_WC_PATH/.svn/pristine/??/', creating shard dirs where
@@ -193,6 +179,10 @@ def move_and_shard_pristine_files(old_wc
   old_pristine_dir = pristine_path(old_wc_path)
   new_pristine_dir = pristine_path(new_wc_path)
 
+  if not os.path.exists(old_pristine_dir):
+    # That's fine, assuming there are no pristine texts.
+    return
+
   for basename in os.listdir(old_pristine_dir):
     shard = basename[:2]
     old = os.path.join(old_pristine_dir, basename)
@@ -232,6 +222,8 @@ def migrate_wc_subdirs(wc_root_path):
         os.remove(db_path(wc_subdir_path))
         print "moving pristines ... ",
         move_and_shard_pristine_files(wc_subdir_path, '.')
+        if os.path.exists(pristine_path(wc_subdir_path)):
+          os.rmdir(pristine_path(wc_subdir_path))
         print "done"
       except (WrongFormatException, NotASubversionWC), e:
         print "skipped:", e
@@ -288,7 +280,7 @@ if __name__ == '__main__':
     sys.exit(1)
 
   print "merging subdir DBs into single DB '" + wc_root_path + "'"
-  shard_pristine_files(wc_root_path)
+  move_and_shard_pristine_files(wc_root_path, wc_root_path)
   migrate_wc_subdirs(wc_root_path)
   bump_wc_format_number(wc_root_path)