Browse Source

change isUnchangablePoint to Pkg's method IsFixed

pull/103/head
Lunny Xiao 11 years ago
parent
commit
8fe66176a5
  1. 14
      cmd/get.go
  2. 9
      doc/struct.go

14
cmd/get.go

@ -188,18 +188,6 @@ func copyToGopath(srcPath, destPath string) {
log.Log("Package copied to GOPATH: %s", importPath)
}
func isUnchangablePoint(nod *doc.Node) bool {
if len(nod.Value) == 0 {
return false
}
switch nod.Type {
case doc.COMMIT, doc.TAG:
return true
}
return false
}
// downloadPackages downloads packages with certain commit,
// if the commit is empty string, then it downloads all dependencies,
// otherwise, it only downloada package with specific commit only.
@ -227,7 +215,7 @@ func downloadPackages(ctx *cli.Context, nodes []*doc.Node) {
installPath := path.Join(installRepoPath, n.RootPath) + versionSuffix(n.Value)
// Indicates whether need to download package again.
if isUnchangablePoint(n) && com.IsExist(installPath) {
if n.IsFixed() && com.IsExist(installPath) {
n.IsGetDepsOnly = true
}

9
doc/struct.go

@ -42,6 +42,15 @@ type Pkg struct {
Value string // Branch, tag, commit or local.
}
// If the package is fixed and no need to updated.
// For commit, tag and local, it's fixed. For branch
func (pkg *Pkg) IsFixed() bool {
if pkg.Type == BRANCH || len(pkg.Value) == 0 {
return false
}
return true
}
func (pkg *Pkg) VerString() string {
if pkg.Value == "" {
return pkg.Type

Loading…
Cancel
Save