@log_calls
  def commit(self, scope, user=UNKNOWN_USER, message=EMPTY_MESSAGE, time=None, empty_ok=False, mod_all=False):
    '''Commit current changes to the repository.'''
    repo_tip = self.repo.get_tip(scope)
    prev_rev = self.repo.resolve_rev(scope, self.get_checkout_rev(scope))
    if prev_rev != repo_tip:
      raise InvalidOperation("repository (rev %s) is ahead of working directory (rev %s) for scope '%s': try update first" \
        % (repo_tip, prev_rev, scope))

    local_scope_dir = join_path(self.work_dir, scope)
    (old_fingerprints, new_fingerprints) = self._fingerprint_status(scope, compute_md5=False)
    changelist = changelist_for_fingerprints(old_fingerprints, new_fingerprints, lazy_md5s=True, root_path=local_scope_dir, mod_all=mod_all)
    # Last call filled in MD5s into new_fingerprints if we already knew them; now compute the others.
    new_fingerprints.compute_md5s(local_scope_dir)

    if changelist.is_empty():
      if empty_ok:
        return
      else:
        raise InvalidOperation(scope % "nothing to commit at scope '%s'", suppressable=True)

    # if a new file is tracked and simultaneously removed, raise an error (suppressable).
    for local_path, fp in self.checkout_state.fingerprints.fingerprints.iteritems():
      if fp.state == FileState.ToBeTracked:
        self.checkout_state._check_file_exists(local_path) # sanity check

    log.info("committing changes (%s)", changelist.brief_summary())
    log.stream.write(changelist.to_summary(prefix=scope))

    # Now perform the real repo commit, uploading each new file
    rev = self.repo.commit(scope, local_scope_dir, prev_rev, changelist, user=user, message=message, time=time)

    # And update the checkout state
    self.checkout_state.update_from_changelist(scope, changelist, new_fingerprints)
    self.checkout_state.update_checkout_rev(scope, rev)
    self._write_checkout_state()
dataset/ETHPy150Open bloomreach/zinc/zinc.py/WorkingDir.commit/swapped operands of `%`