Exemple #1
0
  def run(self):
    self.begin.emit()
    try:
      self.remote = str(self.remote)
      self.local = str(self.local)

      client, host_path = get_transport_and_path(self.remote)

      if os.path.isdir(os.path.join(self.local, '.git')):
        repo = Repo(self.local)
      else:
        repo = Repo.init(self.local, mkdir=True)

      remote_refs = client.fetch(host_path, repo,
        determine_wants=repo.object_store.determine_wants_all,
        progress=self.progress.emit)
      repo["HEAD"] = remote_refs["HEAD"]
      repo._build_tree()
      self.progress.emit(tr('Up-to-date.'))
    except Exception as error:
      self.error.emit(error)
    finally:
      self.finish.emit()