# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@gmail.com>
# Date 1624277606 -7200
#      Mon Jun 21 14:13:26 2021 +0200
# Node ID ed67ba8322e00ab30e937c40f8d6fc85d8644233
# Parent  e458974762e2637289e5f0c8c5b7f41521cb3a02
pull: don't save map file at start

When the map save frequency is set, we would previously save it the
very start of the pull. 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
@@ -837,8 +837,8 @@
 
         mapsavefreq = self.ui.configint(b'hggit', b'mapsavefrequency')
         with self.ui.makeprogress(b'importing', unit=b'commits', total=total) as progress:
-            for i, csha in enumerate(commits):
-                progress.update(i)
+            for i, csha in enumerate(commits, 1):
+                progress.increment()
                 commit = commit_cache[csha]
                 self.import_git_commit(commit)
                 if mapsavefreq and i % mapsavefreq == 0:
diff --git a/tests/test-transactions.t b/tests/test-transactions.t
--- a/tests/test-transactions.t
+++ b/tests/test-transactions.t
@@ -101,7 +101,7 @@
   13 
   12 
   11 
-  10 b18e34c1c0afbb0d8406d4cc9c160e8bf3beaf80
+  10 
   9 1d6b9d3de3098d28bb786d18849f5790a08a9a08
   8 42da70ed92bbecf9f348ba59c93646be723d0bf2
   7 17e841146e5744b81af9959634d82c20a5d7df52
@@ -126,7 +126,7 @@
   13 
   12 
   11 
-  10 b18e34c1c0afbb0d8406d4cc9c160e8bf3beaf80
+  10 
   9 1d6b9d3de3098d28bb786d18849f5790a08a9a08
   8 42da70ed92bbecf9f348ba59c93646be723d0bf2
   7 17e841146e5744b81af9959634d82c20a5d7df52