changeset 1000:d0ce6eaebe7b

githandler: respect mapsavefrequency during export When importing changesets, hggit uses the config knob hggit.mapsavefrequency to determine how often to save the mapfile. This allows a user to interrupt the import without losing all progress. This patch adds this same functionality to the export mechanism.
author Ryan McElroy <rmcelroy@fb.com>
date Mon, 03 Oct 2016 04:43:48 -0700
parents a128b9a53b5a
children fa23c454c528
files hggit/git_handler.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py	Thu Oct 06 10:11:14 2016 +0200
+++ b/hggit/git_handler.py	Mon Oct 03 04:43:48 2016 -0700
@@ -459,9 +459,13 @@
         exporter = hg2git.IncrementalChangesetExporter(
             self.repo, pctx, self.git.object_store, gitcommit)
 
+        mapsavefreq = self.ui.configint('hggit', 'mapsavefrequency', 0)
         for i, ctx in enumerate(export):
             self.ui.progress('exporting', i, total=total)
             self.export_hg_commit(ctx.node(), exporter)
+            if mapsavefreq and i % mapsavefreq == 0:
+                self.ui.debug(_("saving mapfile\n"))
+                self.save_map(self.map_file)
         self.ui.progress('exporting', None, total=total)
 
     def set_commiter_from_author(self, commit):