Updated the YAML properties for version and pin The version property replaces the ref property because it can support a reference and a semantic version constraint. The ref property will still be supported but is deprecated. The pin property is for upcoming work on pinning.
diff --git a/README.md b/README.md index 6aa8721..5d97527 100644 --- a/README.md +++ b/README.md
@@ -257,7 +257,7 @@ - package: github.com/kylelemons/go-gypsy - package: github.com/Masterminds/cookoo vcs: git - ref: master + version: master repo: git@github.com:Masterminds/cookoo.git ``` @@ -275,7 +275,7 @@ `github.com/Masterminds/cookoo` in the `vendor` directory. (Note that `package` and `repo` can be completely different) -**TIP:** The ref is either VCS dependent and can be anything that can be checked +**TIP:** The version is either VCS dependent and can be anything that can be checked out or a semantic version constraint that can be parsed by the [`github.com/ Masterminds/semver`](https://github.com/Masterminds/semver) package. For example, with Git this can be a branch, tag, or hash. This varies and
diff --git a/cmd/yaml.go b/cmd/yaml.go index b1a6e2c..ce95911 100644 --- a/cmd/yaml.go +++ b/cmd/yaml.go
@@ -428,12 +428,12 @@ // Dependency describes a package that the present package depends upon. type Dependency struct { - Name, Reference, Repository string - VcsType string - Subpackages, Arch, Os []string - UpdateAsVendored bool - Flatten bool - Flattened bool + Name, Reference, Pin, Repository string + VcsType string + Subpackages, Arch, Os []string + UpdateAsVendored bool + Flatten bool + Flattened bool } // DependencyFromYaml creates a dependency from a yaml.Node. @@ -444,7 +444,8 @@ } dep := &Dependency{ Name: valOrEmpty("package", pkg), - Reference: valOrEmpty("ref", pkg), + Reference: valOrEmpty("version", pkg), + Pin: valOrEmpty("pin", pkg), VcsType: getVcsType(pkg), Repository: valOrEmpty("repo", pkg), Subpackages: valOrList("subpackages", pkg), @@ -453,6 +454,12 @@ Flatten: boolOrDefault("flatten", pkg, false), } + // Continue to support the legacy ref property for the version. To remove + // support remove the following block. + if dep.Reference == "" { + dep.Reference = valOrEmpty("ref", pkg) + } + if dep.Name != "" { orig := dep.Name dep.Name = getRepoRootFromPackage(orig) @@ -529,7 +536,10 @@ dep["vcs"] = yaml.Scalar(vcs) } if len(d.Reference) > 0 { - dep["ref"] = yaml.Scalar(d.Reference) + dep["version"] = yaml.Scalar(d.Reference) + } + if len(d.Pin) > 0 { + dep["pin"] = yaml.Scalar(d.Pin) } if len(d.Repository) > 0 { dep["repo"] = yaml.Scalar(d.Repository)
diff --git a/docs/example-glide.yaml b/docs/example-glide.yaml index f972ca2..7b27acc 100644 --- a/docs/example-glide.yaml +++ b/docs/example-glide.yaml
@@ -20,20 +20,21 @@ - package: github.com/kylelemons/go-gypsy # Full definition - # This will check out the given Git repo, set the reference to master, + # This will check out the given Git repo, set the version to master, # use "git" (not "go get") to manage it, and alias the package to the # import path github.com/Masterminds/cookoo - package: github.com/Masterminds/cookoo vcs: git - ref: master + version: master repo: git@github.com:Masterminds/cookoo.git - # Here's an example with a commit hash for a ref. Since repo is not specified, - # this will use git to to try to clone 'http://github.com/aokoli/goutils' - # and then set the revision to the given hash. + # Here's an example with a commit hash for a version. Since repo is not + # specified, this will use git to to try to clone + # 'http://github.com/aokoli/goutils' and then set the revision to the given + # hash. - package: github.com/aokoli/goutils vcs: git - ref: 9c37978a95bd5c709a15883b6242714ea6709e64 + version: 9c37978a95bd5c709a15883b6242714ea6709e64 # MASKING: This takes my fork of goamz (technosophos/goamz) and clones it # as if it were the crowdmob/goamz package. This is incredibly useful for @@ -64,16 +65,16 @@ - package: bzr.example.com/foo/bar/trunk vcs: bzr repo: bzr://bzr.example.com/foo/bar/trunk - # Only tags can be used as refs. If you'd like to change that... please - # submit a patch. We don't know much about bzr - ref: 1.0.0 + # The version can be a branch, tag, commit id, or a semantic version + # constraint parsable by https://github.com/Masterminds/semver + version: 1.0.0 - package: hg.example.com/foo/bar vcs: hg repo: http://hg.example.com/foo/bar - ref: ae081cd1d6cc + version: ae081cd1d6cc - # For SVN, the only valid ref is a commit number. Tags and branches go in + # For SVN, the only valid version is a commit number. Tags and branches go in # the repo URL. - package: svn.example.com/foo/bar/trunk vcs: svn
diff --git a/glide.yaml b/glide.yaml index d9a3721..d35a193 100644 --- a/glide.yaml +++ b/glide.yaml
@@ -5,12 +5,12 @@ - yaml flatten: true - package: github.com/Masterminds/cookoo - ref: master + version: master repo: git@github.com:Masterminds/cookoo.git vcs: git subpackages: - . - package: github.com/Masterminds/vcs - ref: ^1.0.0 + version: ^1.0.0 - package: github.com/codegangsta/cli - package: github.com/Masterminds/semver