changeset 1146:4cdb0e95604f

svncommands: call util.dump instead of manually writing file
author Sean Farley <sean.michael.farley@gmail.com>
date Mon, 17 Feb 2014 11:18:30 -0600
parents d2b4a65921fe
children 56f426d0261f
files hgsubversion/svncommands.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/svncommands.py
+++ b/hgsubversion/svncommands.py
@@ -87,9 +87,9 @@ def _buildmeta(ui, repo, args, partial=F
     startrev = 0
     sofar = []
     branchinfo = {}
+    youngestpath = os.path.join(svnmetadir, 'lastpulled')
     if partial:
         try:
-            youngestpath = os.path.join(svnmetadir, 'lastpulled')
             foundpartialinfo = False
             if os.path.exists(youngestpath):
                 youngest = util.load(youngestpath)
@@ -111,7 +111,6 @@ def _buildmeta(ui, repo, args, partial=F
             ui.status('no metadata available -- doing a full rebuild\n')
 
 
-    lastpulled = open(os.path.join(svnmetadir, 'lastpulled'), 'wb')
     revmap = open(os.path.join(svnmetadir, 'rev_map'), 'w')
     revmap.write('1\n')
     revmap.writelines(sofar)
@@ -163,7 +162,7 @@ def _buildmeta(ui, repo, args, partial=F
             else:
                 closed.add(parentctx.rev())
 
-    lastpulled.write(str(youngest) + '\n')
+    util.dump(youngest, youngestpath)
     ui.progress('prepare', None, total=numrevs)
 
     for rev in xrange(startrev, len(repo)):