

def finish(self):
    'Finish import\n\n        Finish the import by merging the import branch to the target while\n        performing suitable verification checks.\n        '
    self.log.info('No verification checks enabled')
    self.git.checkout(self.branch)
    current_sha = self.git.rev_parse('HEAD')
    try:
        self.log.info("\n                Merging by inverting the 'ours' strategy discard all changes\n                and replace existing branch contents with the new import.\n                ")
        self.log.info('\n                Merging import branch to HEAD and ignoring changes:\n                    git merge -s ours --no-commit %s\n                ', self.import_branch)
        self.git.merge('-s', 'ours', self.import_branch, no_commit=True)
        self.log.info('\n                Replacing tree contents with those from the import branch:\n                    git read-tree -u --reset %s\n                ', self.import_branch)
        self.git.read_tree(self.import_branch, u=True, reset=True)
        self.log.info('\n                Committing merge commit:\n                    git commit --no-edit\n                ')
        self.git.commit(no_edit=True)
        if (self.git.rev_parse('HEAD^{tree}') != self.git.rev_parse(('%s^{tree}' % self.import_branch))):
            raise ImportUpstreamError('Resulting tree does not match import')
    except (GitCommandError, ImportUpstreamError):
        self.log.error("\n                Failed to finish import by merging branch:\n                    '%s'\n                into and replacing the contents of:\n                    '%s'\n                ", self.import_branch, self.branch)
        self._set_branch(self.branch, current_sha, force=True)
        return False
    except Exception:
        self.log.exception('Unknown exception during finish')
        self._set_branch(self.branch, current_sha, force=True)
        raise
    return True

dataset/ETHPy150Open openstack/git-upstream/git_upstream/lib/importupstream.py ImportUpstream.finish/original