Mercurial > hg > hg-git
diff hggit/git_handler.py @ 917:6aa31a3b0506
gitimport: add save frequency config
If the importer encountered an error half way through a large import, all the
commits are saved, but the mapfile is not written, so the process starts over
from the beginning when run again.
This adds the option for a config value that will save the map file every X
commits. I thought about just hard coding this to 100 or something, but doing it
this way seems a little less invasive.
author | Durham Goode <durham@fb.com> |
---|---|
date | Thu, 11 Jun 2015 13:56:16 -0700 |
parents | efcefc3522bd |
children | 3246f2fab625 |
line wrap: on
line diff
--- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -703,10 +703,14 @@ else: self.ui.status(_("no changes found\n")) + mapsavefreq = self.ui.configint('hggit', 'mapsavefrequency', 0) for i, csha in enumerate(commits): self.ui.progress('importing', i, total=total, unit='commits') commit = commit_cache[csha] self.import_git_commit(commit) + if mapsavefreq and i % mapsavefreq == 0: + self.ui.debug(_("saving mapfile\n")) + self.save_map(self.map_file) self.ui.progress('importing', None, total=total, unit='commits') # TODO if the tags cache is used, remove any dangling tag references