# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@gmail.com>
# Date 1624032063 -7200
#      Fri Jun 18 18:01:03 2021 +0200
# Node ID e458974762e2637289e5f0c8c5b7f41521cb3a02
# Parent  8e2bc49d6ef93ea1e733c882a22b93ab158faa77
push: don't save map file at start

When the map save frequency is set, we would previously save it the
very start of the push. That doesn't make much sense, so we switch it
one commit later to avoid the unnecessary I/O.

diff --git a/hggit/git_handler.py b/hggit/git_handler.py
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -554,8 +554,8 @@
 
         mapsavefreq = self.ui.configint(b'hggit', b'mapsavefrequency')
         with self.repo.ui.makeprogress(b'exporting', total=total) as progress:
-            for i, ctx in enumerate(export):
-                progress.update(i, total=total)
+            for i, ctx in enumerate(export, 1):
+                progress.increment()
                 self.export_hg_commit(ctx.node(), exporter)
                 if mapsavefreq and i % mapsavefreq == 0:
                     self.save_map(self.map_file)