Commits

Bryan O'Sullivan committed e90c31a

buildmeta: write subdir and layout files only if needed

  • Participants
  • Parent commits b62fff7

Comments (0)

Files changed (1)

File hgsubversion/svncommands.py

 
     numrevs = len(repo) - startrev
 
-    subdirfile = open(os.path.join(svnmetadir, 'subdir'), 'w')
-    subdirfile.write(subdir.strip('/'))
-    subdirfile.close()
+    write_if_needed(os.path.join(svnmetadir, 'subdir'), subdir.strip('/'))
 
     # ctx.children() visits all revisions in the repository after ctx. Calling
     # it would make us use O(revisions^2) time, so we perform an extra traversal
                 layout = 'single'
             else:
                 layout = 'standard'
-            f = open(os.path.join(svnmetadir, 'layout'), 'w')
-            f.write(layout)
-            f.close()
+            write_if_needed(os.path.join(svnmetadir, 'layout'), layout)
         elif layout == 'single':
             assert (subdir or '/') == revpath, ('Possible layout detection'
                                                 ' defect in replay')