Browse Source

Added svn update support for option ”—update, -u” of command get when update GOPATH projects

pull/103/head
Unknown 11 years ago
parent
commit
4954b251f8
  1. 20
      cmd/get.go

20
cmd/get.go

@ -355,19 +355,12 @@ func updateByVcs(vcs, dirPath string) error {
switch vcs {
case "git":
stdout, _, err := com.ExecCmd("git", "status")
branch, _, err := com.ExecCmd("git", "rev-parse", "--abbrev-ref", "HEAD")
if err != nil {
log.Error("", "Error occurs when 'git status'")
log.Error("", "Error occurs when 'git rev-parse --abbrev-ref HEAD'")
log.Error("", "\t"+err.Error())
}
i := strings.Index(stdout, "\n")
if i == -1 {
log.Error("", "Empty result for 'git status'")
return nil
}
branch := strings.TrimPrefix(stdout[:i], "# On branch ")
_, _, err = com.ExecCmd("git", "pull", "origin", branch)
if err != nil {
log.Error("", "Error occurs when 'git pull origin "+branch+"'")
@ -392,7 +385,14 @@ func updateByVcs(vcs, dirPath string) error {
log.Error("", "Error: "+stderr)
}
case "svn":
log.Error("", "Error: not support svn yet")
_, stderr, err := com.ExecCmd("svn", "update")
if err != nil {
log.Error("", "Error occurs when 'svn update'")
log.Error("", "\t"+err.Error())
}
if len(stderr) > 0 {
log.Error("", "Error: "+stderr)
}
}
return nil
}

Loading…
Cancel
Save