def pull_from_origin(self, repository):
      """Pulls the current branch from the git origin.

      Args:
        repository [string]: The local repository to update.
      """
      name = repository.name
      repository_dir = get_repository_dir(name)
      if not os.path.exists(repository_dir):
          self.git_clone(repository)
          return

      print 'Updating {name} from origin'.format(name=name)
      branch = self.get_local_branch_name(name)
      if branch != self.pull_branch:
          sys.stderr.write(
              'WARNING: Updating {name} branch={branch}, *NOT* "{want}"\n'
                  .format(name=name, branch=branch, want=self.pull_branch))
      try:
        check_run_and_monitor('git -C "{dir}" pull origin {branch} --tags'
                                  .format(dir=repository_dir, branch=branch),
                              echo=True)
      except RuntimeError:
        result = check_run_and_monitor('git -C "{dir}" branch -r'
                                           .format(dir=repository_dir),
                                       echo=False)
        if result.stdout.find('origin/{branch}\n') >= 0:
          raise
        sys.stderr.write(
              'WARNING {name} branch={branch} is not known to the origin.\n'
              .format(name=name, branch=branch))
dataset/ETHPy150Open spinnaker/spinnaker/dev/refresh_source.py/Refresher.pull_from_origin/original