comparison hggit/git_handler.py @ 709:4f0a154ae374

git_handler: return early when no commits need to be exported This will make our life easier in an upcoming patch.
author Siddharth Agarwal <sid0@fb.com>
date Fri, 14 Mar 2014 19:18:19 -0700
parents 373f854ff58f
children 5c7943ca051f
comparison
equal deleted inserted replaced
708:d5facc1be5f8 709:4f0a154ae374
354 def export_git_objects(self): 354 def export_git_objects(self):
355 clnode = self.repo.changelog.node 355 clnode = self.repo.changelog.node
356 nodes = [clnode(n) for n in self.repo] 356 nodes = [clnode(n) for n in self.repo]
357 export = [node for node in nodes if not hex(node) in self._map_hg] 357 export = [node for node in nodes if not hex(node) in self._map_hg]
358 total = len(export) 358 total = len(export)
359 if total: 359 if not total:
360 self.ui.note(_("exporting hg objects to git\n")) 360 return
361
362 self.ui.note(_("exporting hg objects to git\n"))
361 363
362 # By only exporting deltas, the assertion is that all previous objects 364 # By only exporting deltas, the assertion is that all previous objects
363 # for all other changesets are already present in the Git repository. 365 # for all other changesets are already present in the Git repository.
364 # This assertion is necessary to prevent redundant work. 366 # This assertion is necessary to prevent redundant work.
365 exporter = hg2git.IncrementalChangesetExporter(self.repo) 367 exporter = hg2git.IncrementalChangesetExporter(self.repo)