Mercurial > hg-git
comparison hggit/git_handler.py @ 685:c7129c72baff
git_handler: replace util.progress with ui.progress
util.progress was a shim for Mercurial < 1.4.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 19 Feb 2014 18:49:28 -0800 |
parents | 13d64d9dd26c |
children | 7ca655e44d9a |
comparison
equal
deleted
inserted
replaced
684:41bfd48ef2a2 | 685:c7129c72baff |
---|---|
75 if self.lasttopic and self.lasttopic != topic: | 75 if self.lasttopic and self.lasttopic != topic: |
76 self.flush() | 76 self.flush() |
77 self.lasttopic = topic | 77 self.lasttopic = topic |
78 | 78 |
79 pos, total = map(int, m.group(1, 2)) | 79 pos, total = map(int, m.group(1, 2)) |
80 util.progress(self.ui, topic, pos, total=total) | 80 self.ui.progress(topic, pos, total=total) |
81 else: | 81 else: |
82 self.flush(msg) | 82 self.flush(msg) |
83 | 83 |
84 def flush(self, msg=None): | 84 def flush(self, msg=None): |
85 if self.lasttopic: | 85 if self.lasttopic: |
86 util.progress(self.ui, self.lasttopic, None) | 86 self.ui.progress(self.ui, self.lasttopic, None) |
87 self.lasttopic = None | 87 self.lasttopic = None |
88 if msg: | 88 if msg: |
89 self.ui.note(msg + '\n') | 89 self.ui.note(msg + '\n') |
90 | 90 |
91 class GitHandler(object): | 91 class GitHandler(object): |
353 # for all other changesets are already present in the Git repository. | 353 # for all other changesets are already present in the Git repository. |
354 # This assertion is necessary to prevent redundant work. | 354 # This assertion is necessary to prevent redundant work. |
355 exporter = hg2git.IncrementalChangesetExporter(self.repo) | 355 exporter = hg2git.IncrementalChangesetExporter(self.repo) |
356 | 356 |
357 for i, rev in enumerate(export): | 357 for i, rev in enumerate(export): |
358 util.progress(self.ui, 'exporting', i, total=total) | 358 self.ui.progress('exporting', i, total=total) |
359 ctx = self.repo.changectx(rev) | 359 ctx = self.repo.changectx(rev) |
360 state = ctx.extra().get('hg-git', None) | 360 state = ctx.extra().get('hg-git', None) |
361 if state == 'octopus': | 361 if state == 'octopus': |
362 self.ui.debug("revision %d is a part " | 362 self.ui.debug("revision %d is a part " |
363 "of octopus explosion\n" % ctx.rev()) | 363 "of octopus explosion\n" % ctx.rev()) |
364 continue | 364 continue |
365 self.export_hg_commit(rev, exporter) | 365 self.export_hg_commit(rev, exporter) |
366 util.progress(self.ui, 'exporting', None, total=total) | 366 self.ui.progress('exporting', None, total=total) |
367 | 367 |
368 | 368 |
369 # convert this commit into git objects | 369 # convert this commit into git objects |
370 # go through the manifest, convert all blobs/trees we don't have | 370 # go through the manifest, convert all blobs/trees we don't have |
371 # write the commit object (with metadata info) | 371 # write the commit object (with metadata info) |
641 total = len(commits) | 641 total = len(commits) |
642 if total: | 642 if total: |
643 self.ui.status(_("importing git objects into hg\n")) | 643 self.ui.status(_("importing git objects into hg\n")) |
644 | 644 |
645 for i, csha in enumerate(commits): | 645 for i, csha in enumerate(commits): |
646 util.progress(self.ui, 'importing', i, total=total, unit='commits') | 646 self.ui.progress('importing', i, total=total, unit='commits') |
647 commit = convert_list[csha] | 647 commit = convert_list[csha] |
648 self.import_git_commit(commit) | 648 self.import_git_commit(commit) |
649 util.progress(self.ui, 'importing', None, total=total, unit='commits') | 649 self.ui.progress('importing', None, total=total, unit='commits') |
650 | 650 |
651 # TODO if the tags cache is used, remove any dangling tag references | 651 # TODO if the tags cache is used, remove any dangling tag references |
652 | 652 |
653 def import_git_commit(self, commit): | 653 def import_git_commit(self, commit): |
654 self.ui.debug(_("importing: %s\n") % commit.id) | 654 self.ui.debug(_("importing: %s\n") % commit.id) |