// Rename renames a file.
762424
func (c *Client) Rename(oldname, newname string) error {
	id := c.nextID()
	typ, data, err := c.sendPacket(sshFxpRenamePacket{
		ID:      id,
		Oldpath: oldname,
		Newpath: newname,
	})
	if err != nil {
		return err
	}
	switch typ {
	case ssh_FXP_STATUS:
		return normaliseError(unmarshalStatus(id, data))
	default:
		return unimplementedPacketErr(typ)
	}
}
1240656
func (f *File) RenameSectionRaw(name, value string) {
	s := f.GetSection(name)
	s.name = value
}
280417
func (j *Jenkins) RenameJob(job string, name string) *Job {
	jobObj := Job{Jenkins: j, Raw: new(JobResponse), Base: "/job/" + job}
	jobObj.Rename(name)
	return &jobObj
}
443442
func RenameOrCopy(src, dst fs.Filesystem, from, to string) error {
	renameLock.Lock()
	defer renameLock.Unlock()

	return withPreparedTarget(dst, from, to, func() error {
		// Optimisation 1
		if src.Type() == dst.Type() && src.URI() == dst.URI() {
			return src.Rename(from, to)
		}

		// "Optimisation" 2
		// Try to find a common prefix between the two filesystems, use that as the base for the new one
		// and try a rename.
		if src.Type() == dst.Type() {
			commonPrefix := fs.CommonPrefix(src.URI(), dst.URI())
			if len(commonPrefix) > 0 {
				commonFs := fs.NewFilesystem(src.Type(), commonPrefix)
				err := commonFs.Rename(
					filepath.Join(strings.TrimPrefix(src.URI(), commonPrefix), from),
					filepath.Join(strings.TrimPrefix(dst.URI(), commonPrefix), to),
				)
				if err == nil {
					return nil
				}
			}
		}

		// Everything is sad, do a copy and delete.
		if _, err := dst.Stat(to); !fs.IsNotExist(err) {
			err := dst.Remove(to)
			if err != nil {
				return err
			}
		}

		err := copyFileContents(src, dst, from, to)
		if err != nil {
			_ = dst.Remove(to)
			return err
		}

		return withPreparedTarget(src, from, from, func() error {
			return src.Remove(from)
		})
	})
}
1132971
func Rename(u *user.User, oldpath, newpath string) error {
	uid, gid, err := getIds(u)
	if err != nil {
		return err
	}
	args := C.au_rename_args_t{
		ids:     C.au_ids_t{uid: uid, gid: gid},
		oldpath: C.CString(oldpath),
		newpath: C.CString(newpath),
	}

	if ret, err := C.au_rename(&args); ret < 0 {
		return err
	}
	return nil
}
26945
func (c *Container) Rename(ctx context.Context, newName string) error {
	return c.client.ContainerRename(ctx, c.container.ID, newName)
}
1320965
func (s *Shape) Rename(newName string) {
	if s.AliasedShapeName {
		panic(fmt.Sprintf("attempted to rename %s, but flagged as aliased",
			s.ShapeName))
	}

	for _, r := range s.refs {
		r.OrigShapeName = r.ShapeName
		r.ShapeName = newName
	}

	delete(s.API.Shapes, s.ShapeName)
	s.OrigShapeName = s.ShapeName
	s.API.Shapes[newName] = s
	s.ShapeName = newName
}
493291
func (client *storageRESTClient) RenameFile(srcVolume, srcPath, dstVolume, dstPath string) (err error) {
	values := make(url.Values)
	values.Set(storageRESTSrcVolume, srcVolume)
	values.Set(storageRESTSrcPath, srcPath)
	values.Set(storageRESTDstVolume, dstVolume)
	values.Set(storageRESTDstPath, dstPath)
	respBody, err := client.call(storageRESTMethodRenameFile, values, nil, -1)
	defer http.DrainBody(respBody)
	return err
}
510316
function renameFiles(files)
{
  files.forEach(function (file)
  {
    var originalName = path.basename(file);
    var newFileName = originalName.toLowerCase();
    var directory = path.dirname(file);
    if (originalName != newFileName)
    {
      fs.renameSync(file, directory + "/" + newFileName); //, function(err)

      if (debug)
        console.log('Renamed: %s --> %s', originalName, newFileName);

      originalFiles.push(originalName);
      renamedFiles.push(newFileName);
    }
  });
}
846676
func (s *storageRESTServer) RenameFileHandler(w http.ResponseWriter, r *http.Request) {
	if !s.IsValid(w, r) {
		return
	}
	vars := mux.Vars(r)
	srcVolume := vars[storageRESTSrcVolume]
	srcFilePath := vars[storageRESTSrcPath]
	dstVolume := vars[storageRESTDstVolume]
	dstFilePath := vars[storageRESTDstPath]
	err := s.storage.RenameFile(srcVolume, srcFilePath, dstVolume, dstFilePath)
	if err != nil {
		s.writeErrorResponse(w, err)
	}
}
123661
func (fs *fakeFs) Rename(oldpath, newpath string) error {
	return fs.a.Fs.Rename(oldpath, newpath)
}
1306960
func (b *SqliteBuilder) RenameColumn(table, oldName, newName string) *Query {
	q := b.NewQuery("")
	q.LastError = errors.New("SQLite does not support renaming columns")
	return q
}
591178
func (r *RenameFamilies) Transform(mfs []*dto.MetricFamily) []*dto.MetricFamily {
	renamed := mfs[:0]
	for _, mf := range mfs {
		if to, ok := r.FromTo[mf.GetName()]; ok {
			mf.Name = &to
		}
		renamed = append(renamed, mf)

	}
	sort.Sort(familySorter(renamed))
	return renamed
}
984897
func (a *API) renameExportable() {
	for name, op := range a.Operations {
		newName := a.ExportableName(name)
		if newName != name {
			delete(a.Operations, name)
			a.Operations[newName] = op
		}
		op.ExportedName = newName
	}

	for k, s := range a.Shapes {
		// FIXME SNS has lower and uppercased shape names with the same name,
		// except the lowercased variant is used exclusively for string and
		// other primitive types. Renaming both would cause a collision.
		// We work around this by only renaming the structure shapes.
		if s.Type == "string" {
			continue
		}

		for mName, member := range s.MemberRefs {
			ref := s.MemberRefs[mName]
			ref.OrigShapeName = mName
			s.MemberRefs[mName] = ref

			newName := a.ExportableName(mName)
			if newName != mName {
				delete(s.MemberRefs, mName)
				s.MemberRefs[newName] = member

				// also apply locationName trait so we keep the old one
				// but only if there's no locationName trait on ref or shape
				if member.LocationName == "" && member.Shape.LocationName == "" {
					member.LocationName = mName
				}
			}

			if newName == "_" {
				panic("Shape " + s.ShapeName + " uses reserved member name '_'")
			}
		}

		newName := a.ExportableName(k)
		if newName != s.ShapeName {
			s.Rename(newName)
		}

		s.Payload = a.ExportableName(s.Payload)

		// fix required trait names
		for i, n := range s.Required {
			s.Required[i] = a.ExportableName(n)
		}
	}

	for _, s := range a.Shapes {
		// fix enum names
		if s.IsEnum() {
			s.EnumConsts = make([]string, len(s.Enum))
			for i := range s.Enum {
				shape := s.ShapeName
				shape = strings.ToUpper(shape[0:1]) + shape[1:]
				s.EnumConsts[i] = shape + s.EnumName(i)
			}
		}
	}
}
104376
func RenameRepoAction(actUser *User, oldRepoName string, repo *Repository) error {
	return renameRepoAction(x, actUser, oldRepoName, repo)
}
320423
func (c *syncClient) Rename(arg0 string, arg1 string) (err Error) {
	arg0bytes := []byte(arg0)
	arg1bytes := []byte(arg1)

	_, err = c.conn.ServiceRequest(&RENAME, [][]byte{arg0bytes, arg1bytes})
	return
}
453256
func (s *ChannelsService) Rename(channel string, name string) *ChannelsRenameCall {
	var call ChannelsRenameCall
	call.service = s
	call.channel = channel
	call.name = name
	return &call
}