diff options
author | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
---|---|---|
committer | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
commit | 107c1cdb09c575aa2f61d97f48d8587eb6bada4c (patch) | |
tree | ca7d008643efc555c388baeaf1d986e0b6b3e28c /vendor/github.com/hashicorp/go-getter/get_hg.go | |
parent | 844b5a68d8af4791755b8f0ad293cc99f5959183 (diff) | |
download | terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.gz terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.zst terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.zip |
Upgrade to 0.12
Diffstat (limited to 'vendor/github.com/hashicorp/go-getter/get_hg.go')
-rw-r--r-- | vendor/github.com/hashicorp/go-getter/get_hg.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/vendor/github.com/hashicorp/go-getter/get_hg.go b/vendor/github.com/hashicorp/go-getter/get_hg.go index f386922..290649c 100644 --- a/vendor/github.com/hashicorp/go-getter/get_hg.go +++ b/vendor/github.com/hashicorp/go-getter/get_hg.go | |||
@@ -1,6 +1,7 @@ | |||
1 | package getter | 1 | package getter |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "context" | ||
4 | "fmt" | 5 | "fmt" |
5 | "net/url" | 6 | "net/url" |
6 | "os" | 7 | "os" |
@@ -9,18 +10,21 @@ import ( | |||
9 | "runtime" | 10 | "runtime" |
10 | 11 | ||
11 | urlhelper "github.com/hashicorp/go-getter/helper/url" | 12 | urlhelper "github.com/hashicorp/go-getter/helper/url" |
12 | "github.com/hashicorp/go-safetemp" | 13 | safetemp "github.com/hashicorp/go-safetemp" |
13 | ) | 14 | ) |
14 | 15 | ||
15 | // HgGetter is a Getter implementation that will download a module from | 16 | // HgGetter is a Getter implementation that will download a module from |
16 | // a Mercurial repository. | 17 | // a Mercurial repository. |
17 | type HgGetter struct{} | 18 | type HgGetter struct { |
19 | getter | ||
20 | } | ||
18 | 21 | ||
19 | func (g *HgGetter) ClientMode(_ *url.URL) (ClientMode, error) { | 22 | func (g *HgGetter) ClientMode(_ *url.URL) (ClientMode, error) { |
20 | return ClientModeDir, nil | 23 | return ClientModeDir, nil |
21 | } | 24 | } |
22 | 25 | ||
23 | func (g *HgGetter) Get(dst string, u *url.URL) error { | 26 | func (g *HgGetter) Get(dst string, u *url.URL) error { |
27 | ctx := g.Context() | ||
24 | if _, err := exec.LookPath("hg"); err != nil { | 28 | if _, err := exec.LookPath("hg"); err != nil { |
25 | return fmt.Errorf("hg must be available and on the PATH") | 29 | return fmt.Errorf("hg must be available and on the PATH") |
26 | } | 30 | } |
@@ -58,7 +62,7 @@ func (g *HgGetter) Get(dst string, u *url.URL) error { | |||
58 | return err | 62 | return err |
59 | } | 63 | } |
60 | 64 | ||
61 | return g.update(dst, newURL, rev) | 65 | return g.update(ctx, dst, newURL, rev) |
62 | } | 66 | } |
63 | 67 | ||
64 | // GetFile for Hg doesn't support updating at this time. It will download | 68 | // GetFile for Hg doesn't support updating at this time. It will download |
@@ -93,7 +97,7 @@ func (g *HgGetter) GetFile(dst string, u *url.URL) error { | |||
93 | return err | 97 | return err |
94 | } | 98 | } |
95 | 99 | ||
96 | fg := &FileGetter{Copy: true} | 100 | fg := &FileGetter{Copy: true, getter: g.getter} |
97 | return fg.GetFile(dst, u) | 101 | return fg.GetFile(dst, u) |
98 | } | 102 | } |
99 | 103 | ||
@@ -108,13 +112,13 @@ func (g *HgGetter) pull(dst string, u *url.URL) error { | |||
108 | return getRunCommand(cmd) | 112 | return getRunCommand(cmd) |
109 | } | 113 | } |
110 | 114 | ||
111 | func (g *HgGetter) update(dst string, u *url.URL, rev string) error { | 115 | func (g *HgGetter) update(ctx context.Context, dst string, u *url.URL, rev string) error { |
112 | args := []string{"update"} | 116 | args := []string{"update"} |
113 | if rev != "" { | 117 | if rev != "" { |
114 | args = append(args, rev) | 118 | args = append(args, rev) |
115 | } | 119 | } |
116 | 120 | ||
117 | cmd := exec.Command("hg", args...) | 121 | cmd := exec.CommandContext(ctx, "hg", args...) |
118 | cmd.Dir = dst | 122 | cmd.Dir = dst |
119 | return getRunCommand(cmd) | 123 | return getRunCommand(cmd) |
120 | } | 124 | } |