func (s *SvnRepo) Version() (string, error) {
	type Commit struct {
		Revision string `xml:"revision,attr"`
	}
	type Info struct {
		Commit Commit `xml:"entry>commit"`
	}
	out, err := s.RunFromDir("svn", "info", "--xml")
	if err != nil {
		return "", NewLocalError("Unable to retrieve checked out version", err, string(out))
	}
	s.log(out)
	infos := &Info{}
	err = xml.Unmarshal(out, &infos)
	if err != nil {
		return "", NewLocalError("Unable to retrieve checked out version", err, string(out))
	}
	return infos.Commit.Revision, nil
}
Version retrieves the current version.
package vcs
import (
	"encoding/xml"
	"fmt"
	"os"
	"os/exec"
	"path/filepath"
	"runtime"
	"strings"
	"time"
)
func NewSvnRepo(remote, local string) (*SvnRepo, error) {
	ins := depInstalled("svn")
	if !ins {
		return nil, NewLocalError("svn is not installed", nil, "")
	}
	ltype, err := DetectVcsFromFS(local)
	if err == nil && ltype != Svn {
		return nil, ErrWrongVCS
	}
	r := &SvnRepo{}
	r.setRemote(remote)
	r.setLocalPath(local)
	r.Logger = Logger
	if err == nil && r.CheckLocal() {
		out, err := exec.Command("svn", "info", local).CombinedOutput()
		if err != nil {
			return nil, NewLocalError("Unable to retrieve local repo information", err, string(out))
		}
		detectedRemote, err := detectRemoteFromInfoCommand(string(out))
		if err != nil {
			return nil, NewLocalError("Unable to retrieve local repo information", err, string(out))
		}
		if detectedRemote != "" && remote != "" && detectedRemote != remote {
			return nil, ErrWrongRemote
		}
		if remote == "" && detectedRemote != "" {
			r.setRemote(detectedRemote)
		}
	}
	return r, nil
}
type SvnRepo struct {
	base
}
func (s SvnRepo) Vcs() Type {
	return Svn
}
func (s *SvnRepo) Get() error {
	remote := s.Remote()
	if strings.HasPrefix(remote, "/") {
		remote = "file://" + remote
	} else if runtime.GOOS == "windows" && filepath.VolumeName(remote) != "" {
		remote = "file:///" + remote
	}
	out, err := s.run("svn", "checkout", remote, s.LocalPath())
	if err != nil {
		return NewRemoteError("Unable to get repository", err, string(out))
	}
	return nil
}
func (s *SvnRepo) Init() error {
	out, err := s.run("svnadmin", "create", s.Remote())
	if err != nil && s.isUnableToCreateDir(err) {
		basePath := filepath.Dir(filepath.FromSlash(s.Remote()))
		if _, err := os.Stat(basePath); os.IsNotExist(err) {
			err = os.MkdirAll(basePath, 0755)
			if err != nil {
				return NewLocalError("Unable to initialize repository", err, "")
			}
			out, err = s.run("svnadmin", "create", s.Remote())
			if err != nil {
				return NewLocalError("Unable to initialize repository", err, string(out))
			}
			return nil
		}
	} else if err != nil {
		return NewLocalError("Unable to initialize repository", err, string(out))
	}
	return nil
}
func (s *SvnRepo) Update() error {
	out, err := s.RunFromDir("svn", "update")
	if err != nil {
		return NewRemoteError("Unable to update repository", err, string(out))
	}
	return err
}
func (s *SvnRepo) UpdateVersion(version string) error {
	out, err := s.RunFromDir("svn", "update", "-r", version)
	if err != nil {
		return NewRemoteError("Unable to update checked out version", err, string(out))
	}
	return nil
}