Mercurial > hg > hg-git
comparison 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 |
comparison
equal
deleted
inserted
replaced
916:efcefc3522bd | 917:6aa31a3b0506 |
---|---|
701 if total: | 701 if total: |
702 self.ui.status(_("importing git objects into hg\n")) | 702 self.ui.status(_("importing git objects into hg\n")) |
703 else: | 703 else: |
704 self.ui.status(_("no changes found\n")) | 704 self.ui.status(_("no changes found\n")) |
705 | 705 |
706 mapsavefreq = self.ui.configint('hggit', 'mapsavefrequency', 0) | |
706 for i, csha in enumerate(commits): | 707 for i, csha in enumerate(commits): |
707 self.ui.progress('importing', i, total=total, unit='commits') | 708 self.ui.progress('importing', i, total=total, unit='commits') |
708 commit = commit_cache[csha] | 709 commit = commit_cache[csha] |
709 self.import_git_commit(commit) | 710 self.import_git_commit(commit) |
711 if mapsavefreq and i % mapsavefreq == 0: | |
712 self.ui.debug(_("saving mapfile\n")) | |
713 self.save_map(self.map_file) | |
710 self.ui.progress('importing', None, total=total, unit='commits') | 714 self.ui.progress('importing', None, total=total, unit='commits') |
711 | 715 |
712 # TODO if the tags cache is used, remove any dangling tag references | 716 # TODO if the tags cache is used, remove any dangling tag references |
713 return total | 717 return total |
714 | 718 |