Updating get and remove to new export system
diff --git a/action/get.go b/action/get.go index 03c6c67..aab0e4a 100644 --- a/action/get.go +++ b/action/get.go
@@ -18,7 +18,7 @@ // Get fetches one or more dependencies and installs. // // This includes resolving dependency resolution and re-generating the lock file. -func Get(names []string, installer *repo.Installer, insecure, skipRecursive, strip, stripVendor, nonInteract, testDeps bool) { +func Get(names []string, installer *repo.Installer, insecure, skipRecursive, stripVendor, nonInteract, testDeps bool) { if installer.UseCache { cache.SystemLock() } @@ -72,11 +72,9 @@ msg.Err("Failed to set references: %s", err) } - // VendoredCleanup - // When stripping VCS happens this will happen as well. No need for double - // effort. - if installer.UpdateVendored && !strip { - repo.VendoredCleanup(confcopy) + err = installer.Export(confcopy) + if err != nil { + msg.Die("Unable to export dependencies to vendor directory: %s", err) } // Write YAML @@ -93,14 +91,6 @@ msg.Warn("Skipping lockfile generation because full dependency tree is not being calculated") } - if strip { - msg.Info("Removing version control data from vendor directory...") - err := gpath.StripVcs() - if err != nil { - msg.Err("Unable to strip version control data: %s", err) - } - } - if stripVendor { msg.Info("Removing nested vendor and Godeps/_workspace directories...") err := gpath.StripVendor()
diff --git a/action/remove.go b/action/remove.go index fc305f5..bdf96a1 100644 --- a/action/remove.go +++ b/action/remove.go
@@ -25,16 +25,15 @@ // Copy used to generate locks. confcopy := conf.Clone() - confcopy.Imports = inst.List(confcopy) + //confcopy.Imports = inst.List(confcopy) if err := repo.SetReference(confcopy, inst.ResolveTest); err != nil { msg.Err("Failed to set references: %s", err) } - // TODO: Right now, there is no flag to enable this, so this will never be - // run. I am not sure whether we should allow this in a rm op or not. - if inst.UpdateVendored { - repo.VendoredCleanup(confcopy) + err = inst.Export(confcopy) + if err != nil { + msg.Die("Unable to export dependencies to vendor directory: %s", err) } // Write glide.yaml
diff --git a/glide.go b/glide.go index 2e7cb1d..e138505 100644 --- a/glide.go +++ b/glide.go
@@ -225,28 +225,33 @@ Usage: "This will resolve all dependencies for all packages, not just those directly used.", }, cli.BoolFlag{ - Name: "update-vendored, u", - Usage: "Update vendored packages (without local VCS repo). Warning, changes will be lost.", + Name: "update-vendored, u", + Usage: "Update vendored packages (without local VCS repo). Warning, changes will be lost.", + Hidden: true, }, cli.BoolFlag{ - Name: "cache", - Usage: "When downloading dependencies attempt to cache them.", + Name: "cache", + Usage: "When downloading dependencies attempt to cache them.", + Hidden: true, }, cli.BoolFlag{ - Name: "cache-gopath", - Usage: "When downloading dependencies attempt to put them in the GOPATH, too.", + Name: "cache-gopath", + Usage: "When downloading dependencies attempt to put them in the GOPATH, too.", + Hidden: true, }, cli.BoolFlag{ - Name: "use-gopath", - Usage: "Copy dependencies from the GOPATH if they exist there.", + Name: "use-gopath", + Usage: "Copy dependencies from the GOPATH if they exist there.", + Hidden: true, }, cli.BoolFlag{ Name: "resolve-current", Usage: "Resolve dependencies for only the current system rather than all build modes.", }, cli.BoolFlag{ - Name: "strip-vcs, s", - Usage: "Removes version control metadata (e.g, .git directory) from the vendor folder.", + Name: "strip-vcs, s", + Usage: "Removes version control metadata (e.g, .git directory) from the vendor folder.", + Hidden: true, }, cli.BoolFlag{ Name: "strip-vendor, v", @@ -262,8 +267,26 @@ }, }, Action: func(c *cli.Context) error { - if c.Bool("strip-vendor") && !c.Bool("strip-vcs") { - msg.Die("--strip-vendor cannot be used without --strip-vcs") + if c.Bool("delete") { + msg.Warn("The --delete flag is deprecated. This now works by default.") + } + if c.Bool("update-vendored") { + msg.Warn("The --update-vendored flag is deprecated. This now works by default.") + } + if c.String("file") != "" { + msg.Warn("The --flag flag is deprecated.") + } + if c.Bool("cache") { + msg.Warn("The --cache flag is deprecated. This now works by default.") + } + if c.Bool("cache-gopath") { + msg.Warn("The --cache-gopath flag is deprecated.") + } + if c.Bool("use-gopath") { + msg.Warn("The --use-gopath flag is deprecated. Please see overrides.") + } + if c.Bool("strip-vcs") { + msg.Warn("The --strip-vcs flag is deprecated. This now works by default.") } if len(c.Args()) < 1 { @@ -278,15 +301,11 @@ inst := repo.NewInstaller() inst.Force = c.Bool("force") - inst.UseCache = c.Bool("cache") - inst.UseGopath = c.Bool("use-gopath") - inst.UseCacheGopath = c.Bool("cache-gopath") - inst.UpdateVendored = c.Bool("update-vendored") inst.ResolveAllFiles = c.Bool("all-dependencies") inst.ResolveTest = !c.Bool("skip-test") packages := []string(c.Args()) insecure := c.Bool("insecure") - action.Get(packages, inst, insecure, c.Bool("no-recursive"), c.Bool("strip-vcs"), c.Bool("strip-vendor"), c.Bool("non-interactive"), c.Bool("test")) + action.Get(packages, inst, insecure, c.Bool("no-recursive"), c.Bool("strip-vendor"), c.Bool("non-interactive"), c.Bool("test")) return nil }, },
diff --git a/glide.lock b/glide.lock index 04390b5..06b0f01 100644 --- a/glide.lock +++ b/glide.lock
@@ -1,5 +1,5 @@ -hash: 84b989218da3e6a1480e6fa95864e838b1e676a970a14d65fffd33cf052a84fd -updated: 2016-08-11T13:38:46.721068785-04:00 +hash: 67c5571c33bfcb663d32d2b40b9ce1f2a05a3fa2e9f442077277c2782195729c +updated: 2016-08-11T14:07:30.163990133-04:00 imports: - name: github.com/codegangsta/cli version: 1efa31f08b9333f1bd4882d61f9d668a70cd902e
diff --git a/repo/vcs.go b/repo/vcs.go index 6ef9574..76349c9 100644 --- a/repo/vcs.go +++ b/repo/vcs.go
@@ -108,19 +108,20 @@ return fmt.Errorf("%s contains uncommitted changes. Skipping update", dep.Name) } - if dep.Reference == "" { - dep.Reference = defaultBranch(repo) + ver := dep.Reference + if ver == "" { + ver = defaultBranch(repo) } // Check if the current version is a tag or commit id. If it is // and that version is already checked out we can skip updating // which is faster than going out to the Internet to perform // an update. - if dep.Reference != "" { + if ver != "" { version, err := repo.Version() if err != nil { return err } - ib, err := isBranch(dep.Reference, repo) + ib, err := isBranch(ver, repo) if err != nil { return err } @@ -128,7 +129,7 @@ // If the current version equals the ref and it's not a // branch it's a tag or commit id so we can skip // performing an update. - if version == dep.Reference && !ib { + if version == ver && !ib { msg.Debug("%s is already set to version %s. Skipping update.", dep.Name, dep.Reference) return nil }