code: func (c *Client) LockFile(path string) (Lock, error) {
  	lockRes, _, err := c.client.Lock(c.Remote, &lockRequest{
  		Path: path,
  		Ref:  &lockRef{Name: c.RemoteRef.Refspec()},
  	})
  	if err != nil {
  		return Lock{}, errors.Wrap(err, "api")
  	}
  
  	if len(lockRes.Message) > 0 {
  		if len(lockRes.RequestID) > 0 {
  			tracerx.Printf("Server Request ID: %s", lockRes.RequestID)
  		}
  		return Lock{}, fmt.Errorf("Server unable to create lock: %s", lockRes.Message)
  	}
  
  	lock := *lockRes.Lock
  	if err := c.cache.Add(lock); err != nil {
  		return Lock{}, errors.Wrap(err, "lock cache")
  	}
  
  	abs, err := getAbsolutePath(path)
  	if err != nil {
  		return Lock{}, errors.Wrap(err, "make lockpath absolute")
  	}
  
  	// Ensure writeable on return
  	if err := tools.SetFileWriteFlag(abs, true); err != nil {
  		return Lock{}, err
  	}
  
  	return lock, nil
  }
docs: // LockFile attempts to lock a file on the current remote
  // path must be relative to the root of the repository
  // Returns the lock id if successful, or an error